Compacting results vectors between stages of graphics processing

ABSTRACT

Ray tracing, and more generally, graphics operations taking place in a 3-D scene, involve a plurality of constituent graphics operations. Responsibility for executing these operations can be distributed among different sets of computation units. The sets of computation units each can execute a set of instructions on a parallelized set of input data elements and produce results. These results can be that the data elements can be categorized into different subsets, where each subset requires different processing as a next step. The data elements of these different subsets can be coalesced so that they are contiguous in a results set. The results set can be used to schedule additional computation, and if there are empty locations of a scheduling vector (after accounting for the members of a given subset), then those empty locations can be filled with other data elements that require the same further processing as that subset.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.13/525,300, filed on Jun. 16, 2012, now U.S. Pat. No. 8,502,820, whichis a continuation of U.S. patent application Ser. No. 12/941,884, filedon Nov. 8, 2010, now U.S. Pat. No. 8,203,559, which is a continuation ofU.S. patent application Ser. No. 12/408,478, filed on Mar. 20, 2009, nowU.S. Pat. No. 7,830,379, which is a continuation-in-part of U.S. patentapplication Ser. No. 11/856,612, filed on Sep. 17, 2007, now U.S. Pat.No. 7,969,434, which claims priority from and incorporates U.S. Prov.App. No. 60/826,201, entitled “Ray Tracing Enhancements for GraphicalRendering”, filed on Sep. 19, 2006, U.S. patent application Ser. No.12/408,478 also claims priority from U.S. Prov. App. No. 61/038,731,entitled “Coupling Ray Storage and Compute for Memory-Efficient RayIntersection Test Scaling”, filed on Mar. 21, 2008, and from U.S. Prov.App. No. 61/095,890, entitled “Architectures for ParallelizedIntersection Testing and Shading for Ray-Tracing Rendering”, filed onSep. 10, 2008, all of which are incorporated by reference in theirentirety, for all purposes, herein.

BACKGROUND

1. Field

The present invention generally relates to rendering two-dimensionrepresentations from three-dimensional scenes, and more particularly tousing ray tracing for accelerated rendering of photo-realistictwo-dimensional representations of scenes.

2. Description of Related Art

Rendering photo-realistic images with ray tracing is well-known in thecomputer graphics arts. Ray tracing is known to produce photo-realisticimages, including realistic shadow and lighting effects, because raytracing can model the physical behavior of light interacting withelements of a scene. However, ray tracing is also known to becomputationally intensive, and at present, even a state of the artgraphics workstation requires a substantial amount of time to render acomplicated scene using ray tracing.

Ray tracing usually involves obtaining a scene description composed ofgeometric primitives, such as triangles, that describe surfaces ofstructures in the scene, and modeling how light interacts withprimitives in the scene by tracing light rays, starting from a camera,and through numerous potential interactions with scene objects, untilterminating either at light sources, or exiting the scene withoutintersecting a light source.

For example, a scene may comprise a car on a street with buildings oneither side of the street. The car in such a scene may be defined by alarge number of triangles (e.g., 1 million triangles) that approximate acontinuous surface. A camera position from which the scene is viewed isdefined. A ray cast from the camera is often termed a primary ray, whilea ray cast from one object to another, for example, to enable reflectionis often called a secondary ray. An image plane of a selected resolution(e.g., 1024×768 for an SVGA display) is disposed at a selected positionbetween the camera and the scene.

A simplistic ray tracing algorithm involves casting one or more raysfrom the camera through each pixel of the image into the scene. Each rayis then tested against each primitive composing the scene to identify aprimitive which that ray intersects, then it is determined what effectthat primitive has on the ray, for example reflecting and/or refractingit. Such reflection and/or refraction causes the ray to proceed in adifferent direction, and/or split into multiple secondary rays, whichcan take different paths. All of these secondary rays are then testedagainst the scene primitives to determine primitives they intersect, andthe process recursively continues until the secondary (and tertiary,etc.) ray terminates by, for example, leaving the scene, or hitting alight source. While all of these ray/primitive intersections are beingdetermined, a tree mapping them is created. After a ray terminates, thecontribution of the light source is traced back through the tree todetermine its effect on the pixel of the scene. As can be readilyunderstood, the computational complexity of testing 1024×768 (forexample) rays for intersection with millions of triangles iscomputationally expensive—and such ray numbers do not even account forall of the additional rays spawned as a result of material interactionwith intersecting rays).

Rendering a scene with ray tracing has been termed an “embarrassinglyparallel problem” because color information accumulated for each pixelof an image being produced can be accumulated independently of the otherpixels of an image. Thus, although there may be some filtering,interpolation or other processing for pixels prior to outputting a finalimage, color information for image pixels can be determined in parallel.Therefore, it is easy to segment the task of ray tracing an image on agiven set of processing resources by dividing the pixels to be renderedamong the processing resources and performing the rendering of thosepixels in parallel.

In some cases, the processing resources may be a computing platform thatsupports multithreading, while other cases may involve a cluster ofcomputers linked over a LAN, or a cluster of compute cores. For thesetypes of systems, a given processing resource, e.g., a thread, can beinstantiated for processing an assigned ray or group of rays throughcompletion of intersection testing and shading. In other words, usingthe property that pixels can be rendered independently of each other,rays known to contribute to different pixels can be divided amongthreads or processing resources to be intersection tested, and thenshade those intersections, writing results of such shading calculationsto a screen buffer for processing or display.

Some algorithmic approaches directed at this sort of problem have beenproposed. One such approach is disclosed by Matt Pharr, et al. in“Rendering Complex Scenes with Memory-Coherent Ray Tracing” Proceedingsof SigGraph (1997) (“Pharr” herein). Pharr discloses dividing a scene tobe ray traced into geometry voxels, where each geometry voxel is a cubethat encloses scene primitives (e.g., triangles). Pharr also disclosessuperimposing a scheduling grid, where each element of the schedulinggrid is a scheduling voxel that can overlap some portion of the geometryvoxels (i.e., the scheduling voxel is also a volumetric cube in thescene that can be sized differently than the cubes of the geometryvoxels). Each scheduling voxel has an associated ray queue, whichincludes rays that are currently inside, i.e., these rays are enclosedwithin, that scheduling voxel, and information about what geometryvoxels overlap that scheduling voxel.

Pharr discloses that when a scheduling voxel is processed, the rays inthe associated queue are tested for intersection with the primitives inthe geometry voxels that are enclosed by the scheduling voxel. Ifintersection between a ray and a primitive is found, then shadingcalculations are performed, which can result in spawned rays that areadded to the ray queue. If there is no found intersection in thatscheduling voxel, the ray is advanced to the next non-empty schedulingvoxel and placed in that scheduling voxel's ray queue.

Pharr discloses that an advantage sought by this approach is to helpscene geometry to fit within a cache that might normally be providedwith a general purpose processor, such that if the scene geometry withineach scheduling voxel can fit within a cache then that cache would notthrash much during intersection testing of rays with that scenegeometry.

Also, Pharr discloses that by queuing the rays for testing in thescheduling voxel, that when the primitives are fetched into the geometrycache, more work can be performed on them. In situations where multiplescheduling voxels could be processed next, the scheduling algorithm canchoose a scheduling voxel which would minimize the amount of geometrythat needs to be loaded into the geometry cache.

Pharr recognizes that the proposed regular scheduling grid may notperform well if a particular scene has non-uniform complexity, i.e., ahigher density of primitives in some portions of the scene. Pharrhypothesizes that an adaptive data structure, such as an octree could beused in place of the regular scheduling grid. An octree introduces aspatial subdivision in the three-dimensional scene by causing, at eachlevel of the hierarchy, a subdivision along each principal axis (i.e.,the x, y, and z axis) of the scene, such that an octree subdivisionresults in 8 smaller sub-volumes, which can each be divided into 8smaller sub-volumes, etc. At each sub-volume, a divide/do not divideflag is set which determines whether that sub-volume will be furtherdivided or not. Such sub-volumes are indicated for sub-division until anumber of primitives in that sub-volume is low enough for testing. Thus,for an octree, an amount of subdivision can be controlled according tohow many primitives are in a particular portion of the scene. As such,the octree allows varying degrees of volumetric subdivision of a volumeto be rendered.

A similar approach is disclosed in U.S. Pat. No. 6,556,200 to Pfister(“Pfister”). Pfister also discloses partitioning a scene into aplurality of scheduling blocks. A ray queue is provided for each block,and the rays in each queue are ordered spatially and temporally using adependency graph. The rays are traced through each of the schedulingblocks according to the order defined in the dependency graph. Pfisterreferences the Pharr paper and adds that Pfister desires to render morethan one single type of graphical primitive (e.g., not just a triangle),and to devise more complicated scheduling algorithms for the schedulingblocks. Pfister also contemplates staging sub-portions of scene geometryat multiple caching levels in memory hierarchy.

Yet another approach has been referred to as packet tracing, and acommon reference for such packet tracing is “Interactive Renderingthrough Coherent Ray Tracing” by Ingo Wald, Phillip Slusallek, CarstenBenthin, et al., Proceedings of EUROGRAPHICS 2001, pp 153-164, 20(3),Manchester, United Kingdom (September 2001). In this reference, packettracing involves tracing a packet of rays having similar origins anddirections through a grid. The rays emit from a substantially commongrid location and travel in a substantially similar direction, such thatmost of the rays go through common grid locations. Thus, packet tracingrequires identifying rays traveling in a similar direction, from asimilar origin. Another variation on such packet tracing is to usefrustrum rays to bound edges of the packet of rays, such that thefrustrum rays are used to determine which voxels are intersected, whichhelps reduce a number of computations for a given ray packet (i.e., notall rays are tested for intersection, but only those on the outer edgesof the packet). Packet tracing still requires identification of raysthat originate from a similar place and go in a similar direction. Suchrays can be increasingly difficult to identify as rays are reflected,refracted and/or generated during ray tracing.

Still other approaches exist in the area of accelerating ray tracing;one approaches attempts improved cache utilization by more activemanagement of ray state. “Dynamic Ray Scheduling for Improved SystemPerformance” Navratil et al. 2007 IEEE Symposium on Interactive RayTracing, (September 2007) (Navratil) references Pharr, describing thatPharr's algorithm has a weakness of “ray state explosion” that causesPharr to be unsuited for main memory to processor cache traffic. Toaddress this, Navaratil proposes to avoid “ray state explosion” byhaving limitations designed to “actively manage” ray state and geometrystate during ray tracing. One proposal is to separately tracegenerations of rays, so Navratil discloses tracing primary rays first,and then after finishing primary rays, to trace secondary rays, and soon.

The above background shows the diversity of thought and approach thatcontinues to be prevalent in the area of accelerating ray-tracing basedrendering. Also, these references show that further advancements remainin the area of ray tracing. However, discussion of any of thesereferences and techniques is not an admission or an implication that anyof these references, or subject matter in them is prior art to anysubject matter disclosed in this application. Rather, these referencesare addressed to help show differences in approaches to rendering withray tracing. Moreover, treatment of any of these references necessarilyis abbreviated for sake of clarity, and is not exhaustive.

SUMMARY

In a first aspect, a method uses a plurality of computing resources inray tracing a 2-D representation of a 3-D scene. The method comprisesusing a first subset of computing resources for intersection testinggeometric shapes comprising one or more of primitives and geometryacceleration elements with rays traveling in a 3-D scene. Each computingresource of the first subset is operable to communicate with arespective localized memory resource storing a respective subset of therays traveling in the scene. The method comprises communicatingindications of intersections between rays and primitives from the firstsubset of computing resources to a second subset of computing resourcesand using the second subset of the computing resources for executingshading routines associated with identified intersections between raysand primitives; outputs from the shading routines comprise new rays tobe intersection tested.

The method also comprises distributing data defining the new rays amongthe localized memory resources and passing groupings of ray identifiersto the computing resources of the first subset with shape data. Each rayidentifier comprises data other than ray definition data for that ray.The passing of the ray identifiers activates intersection testing ofidentified rays with shapes indicated by the shape data. The testingcomprises, by each computing resource, retrieving data defining anidentified ray stored in its localized memory, testing the indicatedshape for intersection based on the retrieved ray definition data andoutputting an indication of a detected intersection for communication.

Another aspect comprises a system for rendering, using ray tracing, a2-D representation of a 3-D scene composed of primitives. The systemcomprises a plurality of intersection testing resources having access torespective cache memories; the respective cache memories store subsetsof a master copy of ray definition data, ray definition data for eachray maintained in the cache memories until testing of that ray hascompleted.

The system also comprises control logic operable to assign an identifierto each ray and to control testing of each ray by a respective testingresource having access to definition data for that ray in its respectivecache memory. The testing control is effected by providing rayidentifiers to respective test cells storing data for rays to be tested.The system comprises an output queue for identifying rays that havecompleted intersection testing and a respective primitive intersected.The control logic assigns new rays resulting from shading calculationsto replace rays that have completed intersection testing in the cachememories.

In some aspects, one or more of the following can be provided: thecontrol logic provides for the replacement by reusing identifiers forcompleted rays as identifiers for new rays, ray identifiers relate tomemory locations storing respective data defining that ray, and datadefining new rays replaces data stored in memory locations of completedrays.

Still other aspects comprise a system for rendering, using ray tracing,a 2-D representation of a 3-D scene composed of primitives. The systemcomprises a memory storing primitives composing a 3-D scene and aplurality of intersection testing resources. Each intersection testingresource is operable to test at least one ray traveling in the scenewith at least one of the primitives, and output an indication of adetected intersection. The system also comprises a plurality of shaderresources, each operable to run a shading routine associated with aprimitive from an indication of a detected ray/primitive intersection.The system also comprises a first communication link for outputtingindications of detected intersections to the shader resources and asecond communication link for sending, to the intersection testingresources, new rays resulting from running of the shading routines,wherein new rays can be sent to the intersection testing resources andcomplete intersection testing different from a relative order in whichthey were sent. The communications links can be implemented as queues,such as FIFO queues.

Still further aspects include a method of ray tracing a scene composedof primitives in a system having a plurality of compute resourcescoupled to a hierarchical memory structure comprising a main memory andmemories distributed among the compute resources, where the main memoryis higher in latency than the distributed memories. The method comprisesdistributing data defining rays to be intersection tested in the sceneamong the distributed memories, such that subsets of the rays are storedin different ones of the distributed memories, and determining tointersection test a group of the rays, where members of the group arestored in multiple of the distributed memories, with one or moregeometric shapes. The method comprises fetching data defining the one ormore geometric shapes from the main memory, and providing the geometricshape and identifiers for rays of the group to at least one computeresource associated with each distributed memory storing data for a rayof the group. The method also comprises testing each ray of the groupfor intersection with a compute resource associated with at least one ofthe distributed memories storing data for that ray; and collectingintersection testing results from the compute resources.

Still further aspects include a system for intersection testing rayswith primitives composing a 3-D scene. The system comprises a pluralityof intersection test resources, each operable for testing a respectiveray for intersection with a geometric shape. Each respective ray isindicated by a reference provided to each intersection test resource,and the test resources are operable for outputting, to either a firstoutput or a second output, an indication of an intersection between theray and the geometric shape.

One output is for primitive intersections and the other output is forgeometry acceleration element intersections. For example, the firstoutput can provide input to the plurality of shading resources, and befor indications of intersections between rays and primitives, while thesecond output provides input to the ray collection manager and receivesindications of intersections between rays and geometry accelerationelements.

Still further aspects include a ray tracing method that comprisesstoring primitives composing the 3-D representation and geometryacceleration elements respectively bounding selections of the primitivesin a main memory resource, defining rays to be intersection tested inthe scene, and defining an identifier for each of the rays. The methodcomprises, in a system comprising a plurality of separately programmableprocessing resources, storing portions of the ray origin and directiondata in localized memory resources respectively associated with each ofthe processing resources. The method also comprises implementingscheduling of rays for intersection testing by providing identifiers forthe rays scheduled for test, and an indication of a geometric shape tothe processing resources. Each processing resource determines whetherits localized memory resource stores ray definition data for any of theidentified rays, and if so then testing those rays for intersection withthe indicated geometric shape.

Still other aspects include a computer readable medium/media comprisingmachine readable instructions for a system for controlling a pluralityof processing resources to accomplish intersection testing of geometricshapes with rays for use in rendering a 2-D representation of a 3-Dscene. The instructions are for implementing a method that comprisesaccessing a packet of identifiers for rays determined to haveintersected a first geometry acceleration element bounding a firstselection of primitives, and determining other geometry accelerationelements that bound portions of the primitives bounded by the firstgeometry acceleration element. The method also comprises instantiating aplurality of packets, each containing the ray identifiers, and arespective indication of a different one of the other geometryacceleration elements, and providing the plurality of packets to each ofa plurality of computing resources respectively configured forintersection testing of fewer than all the rays identified in eachpacket. The method also comprises receiving indications of intersectionsdetected from the plurality of computing resources; and tracking thereceived indications by a geometry acceleration element untilidentifying a next geometry acceleration element having more than athreshold number of received indications and repeating the accessingwith a next packet.

Still further aspects include a ray tracing system comprising aplurality of computing resources configured for intersection testing ashape with a ray and respective caches coupled with each of thecomputing resources, where each of the caches stores data defining someof a plurality of rays traveling in the scene; and channels for passingmessages among the plurality of computing resources, wherein each of thecomputing resources is configured for interpreting data in a messagereceived by it as containing a plurality of ray identifiers, fordetermining whether its cache has any of the plurality of rays stored init, and to test any stored rays with an associated shape.

Still further aspects include a system for intersection testing rayswith primitives composing a 3-D scene. The system comprises a pluralityof intersection test resources, each operable for testing a respectiveray for intersection with a geometric shape. The respective ray isindicated by a reference provided to each intersection test resource.Each intersection testing resource also is configured for outputting, toeither a first output or a second output, an indication of anintersection between the ray and the primitive. The system furthercomprises a plurality of shading resources, each operable for executingshading code for detected intersections, and a ray collection manageroperable for maintaining references to rays and for providing the rayreferences to the plurality of intersection test resources forindicating rays to be tested. The first output provides input to theplurality of shading resources, and receives indications ofintersections between rays and primitives, and the second outputprovides input to the ray collection manager and receives indications ofintersections between rays and geometry acceleration elements.

Still further aspects comprise a computing configuration for use inparallel ray tracing-based rendering of a 2-D representation of a 3-Dscene, comprising: a processor coupled to a local cache, the local cacheconfigured to store data defining a plurality of rays to be tested forintersection with specified geometric shapes; and an input queueserviced by the processor, data received in the input queueinterpretable by the processor as comprising a plurality of identifiersfor rays to be tested for intersection with an indicated geometricshape, the processor configured to retrieve definition data only for anyray identified in its queue for which there is data stored in theprocessor's local cache, to intersection test any such rays with theindicated geometric shape, and to output indications of any detectedintersections.

Still further aspects include a computer readable medium comprisingmachine readable instructions for implementing a ray tracing methodcomprising accessing a packet of identifiers for rays determined to haveintersected a geometry acceleration element bounding a selection ofprimitives and determining other geometry acceleration elements thatbound portions of the primitives bounded by the intersected geometryacceleration element. The method also comprises instantiating aplurality of packets, each containing the ray identifiers, and arespective indication of a different one of the other geometryacceleration elements and providing the plurality of packets to each ofa plurality of computing resources respectively configured forintersection testing of rays identified in each packet. The method alsocomprises receiving indications of intersections detected from theplurality of computing resources; and tracking the received indicationsaccording to a geometry acceleration element.

Still further aspects comprise a method of ray tracing, which comprisesdetermining ray definition data defining a plurality of rays to betested for intersection with primitives composing a 3-D scene. Themethod also comprises distributing subsets of the ray definition dataamong respective local memories of a plurality of computing resources,the computing resources configured for intersection testing rays withgeometric shapes and in a management module, determining collections ofrays from the plurality to be intersection tested by the computingresources. The collections are defined by a plurality of rayidentifiers, each comprising data other than definition data for theray, and associated with a bounding shape bounding portions of theprimitives. The method also comprises causing the computing resources totest rays of a determined collection by passing ray identifiers for thatcollection among the computing resources, to which each computingresource respectively is responsive by intersection testing identifiedrays for which definition data is stored in the local memory for thatcomputing resource.

In any such aspects, the plurality of rays stored in the local cache canbe a disjoint subset of a second plurality of rays, and some of theplurality of ray identifiers identify rays stored in the local cache andsome rays of the second plurality are not stored in the local cache.

The functional aspects described can be implemented as modules, such asmodules of computer executable code, configuring appropriate hardwareresources operable to produce inputs and outputs as described.

BRIEF DESCRIPTION OF THE DRAWINGS

For a fuller understanding of aspects and examples disclosed herein,reference is made to the accompanying drawings in the followingdescription.

FIG. 1 illustrates a first example of a system for rendering scenes withray tracing;

FIG. 2 illustrates additional aspects of a portion of FIG. 1;

FIG. 3 illustrates another implementation of an intersection testingportion of a ray tracing rendering system;

FIG. 4 illustrates an example of a computing resource for intersectiontesting useful in the systems of FIGS. 1-3;

FIG. 5 illustrates a further example of an intersection testing systemarchitecture for use in ray tracing;

FIG. 6 illustrates aspects of another example of an architecture forintersection testing;

FIG. 7 illustrates a system architecture implementing aspects ofdisclosures from FIGS. 1-6, comprising intersection testing resourcesand shading resources coupled by queues;

FIGS. 8 a and 8 b illustrate aspects of providing identifiers for raysthat can be used in controlling ray tracing in systems according toFIGS. 1-7;

FIGS. 9 a and 9 b illustrate examples of using ray IDs to identify raydata in memories that can be provided for intersection testing resourcesof any of FIGS. 1-7;

FIG. 10 illustrates aspects of intersection testing control and shapedistribution among plural intersection testing resources that can beimplemented in systems of FIGS. 1-7;

FIG. 11 illustrates a multiprocessor architecture in which aspects ofsystems of FIGS. 1-10 can be implemented when using the architecture forray tracing;

FIG. 12 illustrates an organization of plural computing resources withinter-resource communication and localized ray data storage that caneffect an implementation of disclosures from FIGS. 1-11;

FIG. 13 illustrates an example of multiple threads or cores operating asa portion of the computing resources of FIG. 12;

FIGS. 14 a-14 c illustrate different queuing implementations useful forsystems and architectures according to FIGS. 1-13;

FIG. 15 is used to illustrate different ways that ray data can bedistributed among private L1 caches from an L2 cache shared by pluralcomputing resources;

FIG. 16 gives an example of data in packets that can be present in aqueue per these disclosures;

FIG. 17 provides disclosure relating to how a particular computingresource processes ray IDs from a packet, using locally available raydata in intersection testing, and writing back results of such testing;

FIGS. 18 a and 18 b illustrate aspects of an example SIMD architectureprocessing packets of ray ID information;

FIG. 19 illustrates a concept of dispersing ray identifiers, testingrays, and coalescing testing results into further packets for furthertesting;

FIG. 20 illustrates method steps, in the context of data structures,generally applicable in systems according to previous figures; and

FIG. 21 illustrates further method aspects according to this disclosure.

DETAILED DESCRIPTION

The following description is presented to enable a person of ordinaryskill in the art to make and use various aspects of the inventions.Descriptions of specific techniques, implementations and applicationsare provided only as examples. Various modifications to the examplesdescribed herein may be apparent to those skilled in the art, and thegeneral principles defined herein may be applied to other examples andapplications without departing from the scope of the invention. Thisdescription first proceeds by introducing aspects relating to an exampleof a three-dimensional (3-D) scene (FIG. 1), that can be abstracted withgeometry acceleration data, as in the example of FIG. 2. Such a 3-Dscene can be rendered as a two-dimensional representation with systemsand methods according to the examples illustrated and described.

As introduced in the background, a 3-D scene needs to be converted intoa 2-D representation for display. Such conversion requires selecting acamera position, from which the scene is viewed. The camera positionfrequently represents a location of a viewer of the scene (e.g., agamer, a person watching an animated film, etc.) The 2-D representationis usually at a plane location between the camera and the scene, suchthat the 2-D representation comprises an array of pixels at a desiredresolution. A color vector for each pixel is determined throughrendering. During ray tracing, rays can be initially cast from thecamera position to intersect the plane of the 2-D representation at adesired point, and then continue into the 3-D scene. A location at whicha ray intersects the 2-D representation is retained in a data structureassociated with that ray.

A camera position is not necessarily a single point defined in space,and instead a camera position can be diffuse, such that rays can be castfrom a number of points considered within the camera position. Each rayintersects the 2-D representation within a pixel, which can also becalled a sample. In some implementations, a more precise location ofwhere a ray intersected a pixel can be recorded, which may allow moreprecise interpolation and blending of colors.

For clarity in description, data for a certain type of object, e.g., aprimitive (e.g., coordinates for three vertices of a triangle) often isdescribed simply as the object itself, rather than referring to the datafor the object. For example, when referring to “fetching a primitive”,it is to be understood that data representative of that primitive isbeing fetched, rather than a physical realization of that primitive.However, in particular regard to rays, this disclosure distinguishesbetween an identifier for a ray, and data defining the ray itself, andwhere the term “ray” is used, it is considered generic to both a ray IDand data defining the ray, unless the context shows otherwise.

Representing realistic and finely detailed objects in the 3-D scene isusually done by providing a large number of small geometric primitivesthat approximate a surface of the object (i.e., a wire frame model). Assuch, a more intricate object may need to be represented with moreprimitives and smaller primitives than a simpler object. Althoughproviding a benefit of higher resolution, performing intersection testsbetween rays and larger numbers of primitives (as described above, andas will be described further below) is computationally intensive,especially since a complex scene may have many objects. Without someexternal organization imposed on the scene for intersection testing,each ray would have to be tested for intersection with each primitive,which would result in extremely slow intersection testing. Therefore, away reduce a number of ray/primitive intersection tests required per rayis helpful to accelerate ray intersection testing in the scene. One wayto reduce the number of such intersection tests is to provide extrabounding surfaces that abstract the surfaces of a number of primitives.Rays can be first intersection tested against the bounding surfaces toidentify a smaller subset of primitives to intersection test with eachray. Such bounding surface shapes can be provided in a variety ofshapes. In this disclosure, a collection of such bounding surfaceelements is called Geometry Acceleration Data (hereinafter referred toas GAD).

A more extensive treatment of GAD organization, elements, and usages canbe found in U.S. patent application Ser. No. 11/856,612, filed on Sep.17, 2007, which is incorporated by reference herein. Thus, a briefertreatment of GAD is provided here for context, and further detailconcerning these matters can be obtained from the above-referencedapplication.

As introduced, GAD elements generally include a geometric shape thatencloses, in 3-D space, a respective collection of primitives, such thatfailure to intersect a surface of the geometric shape with a rayindicates that the ray also does not intersect any primitive bounded bythe shape. GAD elements can comprise spheres, axis-aligned boundingboxes, kd-trees, octrees, and other sorts of bounding volumehierarchies, and as such, an implementation according to this disclosurecan use a bounding scheme, such as the cutting planes of a kd-tree, oranother way to locate and specify extents of bounding surfaces thatbound one or more scene primitives. In sum, since GAD elements primarilyare useful in abstracting primitives for more quickly identifyingintersections between rays and primitives, GAD elements preferably areshapes that can be easily tested for intersection with a ray.

GAD elements can be interrelated to each other. An interrelation of GADelements herein can be a graph comprising nodes and edges, where thenodes represent GAD elements and the edges represent an interrelationbetween two of the GAD elements. Where a pair of elements is connectedby an edge, the edge may indicate that one of the nodes has a differentrelative granularity than the other node, which can mean that one of thenodes connected by that edge bounds more or fewer primitives than theother node. In some cases, the graph can be hierarchical, such thatthere is a direction to the graph, and the graph can be traversed inorder from parent nodes to child nodes, narrowing remaining boundedprimitives along the way. In some cases, the graph can have homogeneousGAD elements, such that if a given GAD element bounds other GADelements, that given GAD element also does not directly bound primitives(i.e., in a homogenous GAD structure, primitives are bounded directly byleaf node GAD elements, and non-leaf nodes directly bound other GADelements and not primitives.)

A graph of GAD elements can be constructed with a goal of maintainingsome uniformity in a number of elements and/or primitives bounded byeach GAD element. A given scene can be subdivided until such a goal canbe achieved.

In the following description, it is provided that there is a mechanismto determine, based on a ray having been determined to intersection agiven GAD element, what other GAD elements should be tested next inresponse. In an example of a hierarchical graph, then the elementstested next generally would be child nodes of a tested node.

One usage of GAD implemented in a number of the examples herein includesthat when a ray is found to intersect a given GAD element, it iscollected with other rays that also have been determined to intersectthat element. When a number of rays have been collected, a stream of GADelements connected to that element are fetched from main memory andstreamed through testers that each have a different collected ray. Thus,each tester maintains its ray stationary in a local fast memory whilegeometry is fetched from slow memory when needed and allowed to beoverwritten. More generally, this description provides a series ofexamples of how computing resources can be organized to process rays fordetecting intersections of such rays with geometric shapes (GAD elementsand primitives), ultimately to identify what rays hit what primitives.

Other aspects that these examples can implement include any of (1)queues are provided for outputs from intersection testing to shading,(2) that ray data is localized to some degree to compute resources,while geometric shapes are fetched from slower memory when there is adetermination to test certain rays against those shapes, and (3) thatintersection testing is driven by identifying rays (using rayidentifiers) to compute resources performing intersection testing,causing each compute resource to fetch data corresponding to theidentified ray(s) from its localized memory(ies).

The following description present examples of systems and portionsthereof for rendering 2-D representations of 3-D scenes using raytracing. Two principal functional components of such systems are (1)tracing rays to identify intersections and (2) shading identifiedintersections.

FIG. 1 illustrates aspects of a system for use in ray tracing a scenecomposed of primitives. Generally, any of the functions or duties of anyof the functional units in FIG. 1 and other figures may be implementedin multiple hardware units, or pieces of software, software subroutines,and may even be run on different computers. In some cases, suchimplementation is described more particularly, as it can bear on systemfunction and performance.

FIG. 1 illustrates a geometry unit 101, an intersection processing unit102, a sample processing resource 110, a frame buffer 111, and a memoryresource 139 operable or otherwise configured to store or storinggeometry shapes comprising GAD elements and primitives (primitive andGAD storage 103), samples 106, ray shading data 107, and texture data108. Geometry unit 101 inputs a description of a scene to be rendered,and outputs primitives and an acceleration structure comprising GADelements bounding the primitives. Intersection processing 102 shadesidentified intersections between rays and primitives, and uses inputs,such as textures, shading code, and other sample information obtainedfrom the data sources illustrated. Outputs of intersection processing102 comprise new rays (discussed below) and color information that willbe used in producing the 2-D representation of the scene being rendered.All of these functional components can be implemented on one or morehost processing resources, generally indicated by dashed line 185.

As described above, during shading of identified ray/primitiveintersections, intersection processing 102 can generate new rays to beintersection tested. A driver 188 may interface with intersectionprocessing 102 to receive these new rays, and manage communicationbetween intersection processing resource 102 and a localizedintersection testing region 140 that comprises a ray data storage 105and a intersection testing unit 109. Intersection testing region 140tests rays for intersection, and has read access via interface 112 toprimitive and GAD storage 103, and outputs indications of identifiedintersections via results interface 121 to intersection processing 102.It is preferred that local ray data storage 105 be implemented inrelatively fast memory that can be relatively smaller in size, whileprimitive and acceleration structure storage is implemented inrelatively large and slow main memory 139 that can potentially be a maindynamic memory of host 185.

One aspect of ray tracing high resolution scenes is the sheer volume ofray data and shape data involved. For example, rendering a full HDresolution film at 30 frames per second requires determining a color forover 60 million pixels a second (1920×1080>2M, 30 times per second).And, to determine each pixel color, many rays may be required. Thus,many hundreds of millions of rays may need to be processed every second,and if every ray requires several bytes of storage, then ray tracingfull HD scenes can many gigabytes of ray data per second, or more. Also,at any given time, a large amount of ray data must be stored inmemories. There almost always is a tradeoff between access speed andmemory size, such that cost-effective large memories are comparativelyslow. Also, large memories are constructed such that the memories arenot effectively used unless a large-enough block of data can be accessedand used. Thus, one challenge is to be able to consistently identifylarge enough groups of ray to efficiently access them from memory.However, there can be processing overhead, sometimes high overhead, inidentifying such rays, as shown by approaches such as finding and grouptesting of rays with similar origins and directions. In one aspect, thefollowing example architectures disclose how to organize and use aplurality of computing resources, faster more expensive memories, slowerlarger memories to increase throughput of ray intersection testing andshading for scene rendering.

FIG. 1 thus illustrates a decoupling of intersection testing fromshading of identified intersections by a flow of data comprising raydefinition data being stored in a fast memory localized to a computeresource 109 that tests rays for intersection with GAD elements andprimitives. An output of the intersection testing 109 comprisesindications of identified rays intersecting with identified primitives.Intersection processing 102 receives these indications, performs shadingaccording for those intersections, and can instantiate new rays fortesting, which ultimately are stored in fast ray data memory 105. Suchdecoupling can be provided in a variety of implementations that use oneor more of fixed function hardware and general purpose computersprogrammed with software according to this description, withcommunication means selected according to the processing resources used.One recurrent aspect in these implementations however, is that shapedata tested for intersection with rays is transient in intersectiontesting region 140 compared with ray definition data. In other words,where applicable, faster memory is allocated primarily to ray data whileshapes are streamed through testers but little computational resourcesare used to optimize caching of such shape data. Various of thefollowing figures illustrate more particular examples of suchdecoupling, data flow, ray data storage and collocation withintersection testing resources.

FIG. 1 also illustrates that ultimately frame buffer 111 outputs can beused to drive a display 197. However, this is only an example of anoutput that can result from intersection testing and shading operations,which can for convenience be called rendering. For example, outputs alsocan be written to computer readable media that include renderingproducts such as sequences of rendered images for later display or fordistribution on tangible computer readable media or transmitted overnetworks comprising computing resources interconnected by communicationlinks. In some cases, the 3-D scene being rendered can be representativeof a real-world 3-D scene, such as may be the case for immersive virtualreality conferencing or for rendering images comprising perspectives of3-D CAD models. In such cases, the rendering methods operate on orotherwise transform data representative of physical objects. In othercases, the 3-D scene may have some objects representative of physicalobjects and other objects that are not. In still further 3-D scenes, theentirety of the scene may be fictitional, such as in a video game, andso on. Ultimately, however, it is generally the case that the methodsare transformative of articles of memory, displays, and/or computerreadable media.

It also is the case that rendering with ray tracing has been implementedsince 1979, and a variety of techniques have been developed forintersection testing and other functions required to implement renderingwith ray tracing. Therefore, the particular architectures and methodsdescribed herein do not preempt the fundamental principle of ray tracingfor use in rendering 3-D scenes into 2-D representations.

FIG. 2 illustrates that intersection testing unit 109 of intersectiontesting region 140 includes one or more individual test resources(a.k.a. test cells), which can test a geometric shape against a ray. Theregion 140 includes test cells 205 a through 205 n that each receive raydata from ray data storage 105 and geometric shape data from memory 139.Each test cell 205 a-205 n produces results for communication throughresults interface 121 to intersection processing 102, and which caninclude indications whether a given ray has intersected a givenprimitive. By contrast, results of intersection testing GAD elementswith rays are provided to logic 203. Logic 203 maintains collections 210of references to rays that relate those rays to GAD elements that thoserays have been determined to intersect.

Generally, system components are designed to support unknowntime-to-completion of a given, specific, ray test. Intersection testunit 109 has read access to the geometry memory, and has a queue ofreferences to rays as inputs. As an output of intersection testing, eachray is associated with the piece of geometry (called a primitive in thisdisclosure for convenience) that it intersected with first. Other piecesof geometry (i.e., primitives) can be viewed as irrelevant.

As introduced above, region 140 includes ray reference buffer andassociated management logic 203, which maintains list 210 of raycollections to be tested in test cells 205 a-205 n. Buffer managementlogic 203 can be implemented in a fixed function processing resource orin hardware configured with instructions obtained from computer readablemedia. Such instructions can be organized in modules according to thefunctions and tasks attributed to logic 203 herein. A person of ordinaryskill also would be able to provide further implementations of logic 203based on these disclosures.

Logic 203 can assign rays and geometry to test cells, and can handlecommunication with the other units in the design. In one aspect, eachray collection in list 210 comprises a plurality of ray identifiers thatare all to be tested for intersection with one or more geometric shapes,and logic 203 maintains such ray collections. In a more particularexample, the plurality of ray identifiers has been determined tointersect a GAD element identified in the collection, and the next GADelements to be tested for intersection with that plurality of rays arerelated to that intersected GAD element in a graph of GAD elements. Therelated elements for a given collection are fetched from memory 139 whenintersection testing with those elements is to commence.

Stated alternately, logic 203 can retain references indicative of raysintersecting sub-portions of geometry data corresponding to respectivechild nodes in a temporary ray reference buffer, allowing the deferralof further processing of such rays. In examples of hierarchicallyarranged GAD, such deferral can defer processing against sub-portions ofgeometry acceleration data below the child node until a subsequent timewhen the accumulated number of rays intersecting the subportion ofgeometry of the child node is found to be suitable for furtherprocessing.

Logic 203 also can communicate with memory 139 for setting up memorytransactions providing geometric shapes for testing to test cells 205a-205 n. Logic 203 also communicates with ray data storage 105 anddetermines what rays have data stored there. In some implementations,logic 203 can obtain or receive rays from memory 139 or from shadingprocesses executing in intersection processing unit 102 and providethose rays, when space is available, to memory 105 for storage and useduring intersection testing.

Thus, logic 203 can maintain a temporary ray reference buffer whichincludes an association of ray identifiers to identifiers of GAD shapes.In an implementation, an identifier for a GAD element can be hashed toidentify a location in the buffer for storing a given collectionassociated with that GAD element. The associations are generallyreferred to as collections herein when describing storing or collectingsuch data in memory, and in some places in the present application, theterm “packet” is used, generally to connote movement of collection dataduring testing, and returning of results from intersection testing. Suchreturned results can be coalesced into stored collections in memory thatare associated with GAD shapes, as described below.

In sum, FIG. 2 continues to illustrate that ray definition data isstored in fast memory 105, while shape data to be tested forintersection with such rays comes from memory 139. The above disclosurealso shows that it is preferred to have a plurality of next-to-be-testedshapes fetched from memory 139 at once and sequentially tested forintersection with a group of rays known to have intersected a “parent”GAD element.

Now, FIG. 3 includes a block diagram of an example of an IntersectionTesting Unit (ITU) 350 implementation of region 140 (FIG. 1) that can beused in a rendering system for ray tracing two dimensionalrepresentations of a three dimensional scene. ITU 350 includes aplurality of test cells 310 a-310 n and 340 a-340 n. GAD elements areillustrated as being sourced from GAD data storage 103 b and primitivedata is sourced from primitive data storage 103 a.

Test cells 310 a-310 n receive GAD elements and ray data to test againstthose elements (i.e., these test cells test GAD elements). Test cells340 a-340 n receive primitives and ray data to test against thoseprimitives (i.e., these test cells test primitives). Thus, ITU 350 cantest a collection of rays for intersection with primitives and aseparate collection of rays for intersection with GAD elements.

ITU 350 also comprises collection management logic 203 a and collectionbuffer 203 b. Collection buffer 203 b and ray data 105 can be stored ina memory 340 that can receive ray data from memory 139 (for example).Collection buffer 203 b maintains ray references associated with GADelements. Collection management 203 a maintains those collections basedon intersection information from test cells. Collection management 203 aalso can initiate the fetching of primitives and GAD elements frommemory 139 for testing ray collections.

ITU 350 returns indications of identified intersections, which can bebuffered in output buffer 375 for ultimate provision via resultsinterface 121 to intersection processing 102. Indications informationsufficient to identify a ray and a primitive which the ray wasdetermined, within a given degree of precision, to intersect.

ITU 350 can be viewed as a function or a utility that can be calledthrough a control process or driver (e.g., driver 188) that provides ITU350 with rays and geometric shapes against which the rays would betested for intersection. For example, ITU 350 can be fed informationthrough driver 188, i.e., a process that interfaces ITU 350 with otherrendering processes, such as shading, and initial ray generationfunctions. From the perspective of ITU 350, ITU 350 need not be aware ofthe origin of the information provided to it, as region 140 can performintersection testing using the rays, GAD, and primitives (or moregenerally, scene geometry) provided to it, or obtained by it based onother information provided to it.

As described above, ITU 350 may control how, when, and what data isprovided to it, such that ITU 350 is not passive, and may for example,fetch ray or geometry data, or acceleration data as required forintersection testing. For example, ITU 350 may be provided with a largenumber of rays for intersection testing, along with informationsufficient to identify a scene in which the rays are to be tested. Forexample, ITU 350 may be provided more than ten thousand rays (10,000)rays for intersection testing at given time and as testing for thoserays complete, new rays (generated by intersection processing 102) maybe provided to keep the number of rays being processed in the ITU 350 atabout the initial number, as described below. ITU 350 may thereaftercontrol (in logic 203 a (see FIG. 3)) temporary storage of the raysduring processing (in ray collection buffer 203 b (see FIG. 3)) and mayalso initiate fetching of primitives and elements of GAD as neededduring the processing.

As described above, GAD elements and primitives are transient in ITU 350compared to rays, as ray identifiers are maintained in buffer 203 b andorganized with respect to GAD elements, while data defining rays ismaintained ray data 105. Each of buffer 203 b and ray data 105 can bemaintained in memory 340, which may be physically implemented in avariety of ways, such as one or more banks of SRAM caches.

As introduced above, logic 203 a tracks status for ray collectionsstored in memory 340, and determines which collections are ready forprocessing. As shown in FIG. 3, logic 203 a is communicatively coupledto memory 340, and can initiate delivery of rays for testing to each ofthe connected test cells. In situations where GAD elements bound eitheronly GAD elements or only primitives, rather than some combinationthereof, logic 203 a, depending on whether a particular collection isassociated with a GAD element that bounds primitives or other GADelements, can assigns rays either to test cells 340 a-340 n or testcells 310 a-310 n.

In examples where a particular GAD element may bound both other GADelements and primitives, ITU 350 can have datapath for providing bothGAD elements and primitives to each test cell, as well as rays, so thatlogic 203 a can arrange for testing rays of collections among thetesting resources. In such examples, because of the typical differencein shape between GAD elements and primitives (spheres versus triangles,for example), an indication to switch test logic or load an intersectiontest algorithm optimized for the shape being tested may be provided fromlogic 203 a.

Logic 203 a may directly or indirectly cause provision of information totest cells 310 a-310 n and test cells 340 a-340 n. In indirectsituations, logic 203 a can provide information to each test cell sothat each test cell may initiate fetching of ray data for test frommemory 340. Although logic 203 a is illustrated separately from memory340, for simplicity of description, logic 203 a may be implementedwithin circuitry of memory 340, as management functionality performed bylogic 203 a largely relates to data stored in memory 340.

An ability to increase parallelization of access to memory 340 byintersection test resources is an advantage of some aspects describedherein. As such, increasing a number of access ports to memory 340,preferably up to at least one per test cell is advantageous. Exampleorganizations related to such parallelization are further describedbelow.

Also, ITU 350 can operate asynchronously with respect to units thatprovide input data to it, or receive outputs from it. Here,“asynchronous” can include that the ITU may receive and beginintersection testing of additional rays while intersection testingcontinues for previously received rays. Also, “asynchronous” may includethat rays do not need to complete intersection testing in an order thatITU 350 received them. Asynchronous also includes that intersectiontesting resources in ITU 350 are available for assignment or schedulingof intersection testing without regard to position of a ray within a 3-Dscene, or a scheduling grid superimposed on the scene, or to test onlyrays having an intergenerational relationship, such as parent rays andchildren rays spawned from a small number of parent rays, or only raysof a specific generation—e.g., camera rays or secondary rays.

ITU 350 also includes an output buffer 375 which receives indications ofidentified intersections of primitives and rays which intersected theprimitive. In an example, the indications include an identification fora primitive paired with an information sufficient to identify a ray thatintersected the primitive. Identification information for a ray mayinclude a reference, such as an index, which identifies a particular rayin a list of rays. For example, the list may be maintained by driver 188running on a host 185, and the list may be maintained in memory 139.Preferably, memory 139 also includes ray definition data for all therays in memory 340. However, the ray identification information may alsoinclude information, such as the ray's origin and direction, sufficientto reconstruct the ray, if memory 139 does not contain such information.It is usually the case that fewer bits would be required to passreferences, which can be an advantage.

FIG. 4 illustrates an example of a test cell 310 a, which may contain aworking memory 410 and test logic 420. Working memory 410 may be severalregisters, which contain information sufficient to test a line segmentfor intersection with a surface, or may be more complicated in otherimplementations. For example, working memory 410 may store instructionsfor configuring test logic 420 to test a particular shape received forintersection and may detect what shape was received based on the datareceived. Working memory 410 also may cache detected hits, where eachtest cell is configured for testing a series of rays against geometricshapes, or vice versa; then, the cached hits may be output as a group.Working memory may also receive incoming shape data from storage 103 b

Test logic 420 performs the intersection test at an available orselectable resolution, and can return a binary value indicating whetheror not there was an intersection detected. The binary value can bestored in the working memory for reading out, caching, or outputting forlatching during a read cycle, such as a read cycle in memory 340 for aGAD element test.

FIG. 5 illustrates aspects of an implementation of an intersectiontesting unit 500, focusing in more detail on an example memoryorganization. In ITU 500, test cells 510 a-510 n and 540 a-540 n appearand correspond with 310 a-310 n and 540 a-540 n in this example. Thisdoes not imply any requirement as to number of test cells. Thus, in ITU500, both primitives and GAD elements may be tested in parallel. If itwere determined, however, that more test cells of one variety or anotherwould be required, then any test cell could be reconfigured (reallocatedif hardware or reprogrammed if software) as appropriate. As transistordensity continues to increase, more such test cells can be accommodatedin hardware implementations (or as resources available for executingsoftware). As will be described, portions of the test cells can betreated as a operational group, in that they will test rays against acommon shape (i.e., a primitive or GAD element). Test cells 540 a-540 ncan return binary values indicating an intersection with a primitive ata specified precision level (e.g., 16 bits), and can also return a moreprecise indication of where on the primitive the ray intersected, whichcan be useful for larger primitives.

In ITU 500, memory 540 comprises a plurality of independently operationbanks 510-515, each of which has two ports (ports 531 and 532 of bank515 identified). One port is accessed through GAD test logic 505, whilethe other is accessed through primitive test logic 530. Each of GAD andprimitive test logic 505 and 530 operate to manage a flow of databetween respective working buffers 560-565 and 570-575, and respectivelyto obtain GAD elements for test from GAD storage 103 a and fromprimitive storage 103 b.

The banks 510-515 are intended to operate, for the most part, to providenon-conflicting access to ray data by GAD and primitive test logic 505and 530, such that each test cell 510 a-510 n and test cell 540 a-540 ncan be provided a ray from separate banks of 510-515. Suchnon-conflicting access, it would be understood from these disclosures,to be implementable for example by separate cache banks, as well as across-bar architecture allowing access by a port to different physicalportions of memory. If testing of rays stored in a bank by more than onetest cell were permitted, then conflicts could arise where two rays tobe tested reside in the same bank, and in such cases, the accesses canbe handled sequentially by the test logics 505 and 530. In some cases,working buffers 560-565 and 570-575 can be loaded for a next processingcycle while other processing is completed. The ITU 500 also can beorganized into regions. For example, region 578 comprises a test regionfor GAD elements, as it comprises GAD tester 510 a and memory bank 510,while region 579 comprises a test region for both GAD elements andprimitives, as it comprises testers 510 a and 540 a (one for each of GADand primitives) and access to memory bank 510 storing ray data to beused in tests involving those the test cells of region 578 and 579.

By testing rays in consistent arrangements, tracking of which ray isassigned to which test cell can be reduced. For example, each collectioncan have 32 rays, and there may be 32 of test cells 310 a-310 n (510a-510 n). For example, by consistently providing the 4^(th) ray in acollection to test cell 310 d, test cell 310 d need not maintaininformation about what ray was provided to it, but need only return anindication of intersection. As will be shown, other implementations formaintaining consistency can be provided, including passing a packet ofray identifiers among test cells, and allowing test cells to writeintersection results to the packet.

Storage for ray collections may be implemented as an n-way interleavedcache for ray collections, such that any given ray collection may bestored in one of n portions of ray collection buffer 203 b or 520. Raycollection buffer 203 b or 520 may then maintain a list of the raycollections stored in each of the n portions of the buffer. Animplementation of ray collection buffer 203 b or 520 may include usingan identifying characteristic of an element of GAD associated with a raycollection, for example, an identifier string unique among the elementsof GAD used in rendering the scene can be used. The alphanumericcharacter string may be a number, or a hash, or the like. For example, ahash can reference one of the n portions of ray collection buffer 203 band 520.

In other implementations, elements of GAD may be predestined for storagein a given portion of ray collection buffer 203 b and 520 by, forexample, mapping segments of the alphanumeric strings in use toportion(s) of such buffer. Primitive/ray intersection output 580represents an output for identifying potential primitive/rayintersections, output 580 can be serial or parallel. For example, where32 primitive test cells 540 a-540 n exist, output 580 can include 32bits indicating presence or absence of an intersection for each rayagainst the primitive just tested. Of course outputs could come directlyfrom the test cells in other implementations, such as for example, inpacket implementations. Outputs can be serial and can be serially storedby test cells in the packet.

Ray data is received in memory 340 (520) from ray sources, such asshaders. Collection management logic (e.g., 203 a of FIGS. 2&3) operatesto initially assign rays to collections, where each collection isassociated with an element of GAD. For example, an element of GAD may bea root node of the graph, and all rays received are initially assignedto one or more collections associated with the root node. Reception ofrays may also be in groups sized to be a full collection, e.g., from aninput queue, and each such collection can be treated like a collectionidentified in ray collection buffer 203 b, for example.

Focusing on processing of one collection, with the understanding that anumber of collections may be tested in parallel, retrieval of rays ofthe collection associated with the test node from memory 340 isinitiated by collection management logic 203 a, by for example,providing addresses of such rays (ray identifiers), which are stored asdata in the collection, for allowing retrieval of such rays from memory340, or by example of FIG. 5, from banks 510-515, which provide the raydata on plural output ports for reception by test cells (e.g., testcells 560-565).

With regard to testing GAD elements bounded by the node selected fortest (i.e., the GAD element associated with the selected node boundsother GAD elements), distribution of ray data for rays of the collectionbeing tested is finished, and fetching of bounded GAD elements also isperformed (not necessary to have such fetching sequential to raydistribution). For such fetching, logic 203 a can input addressinginformation to GAD storage 103 b (or by whatever memory management meansis provided), which outputs the addressed GAD element(s) to test cells310 a-310 n. Where multiple GAD elements are bounded, as is usually thecase, the elements can be arranged to be streamed serially to testcells, such as with a serializing buffer, so as to allow for block readsof multiple GAD elements.

In the test cells (e.g., 310 a-310 n), rays of the collection can betested for intersection with the serially provided GAD elements (e.g., adifferent ray in each test cell). Where a ray is determined tointersect, it is determined whether a collection for the intersected GADelement exists, if so, then the ray is added to that collection, roompermitting, and if not then the collection is created, and the ray isadded. Where an existing collection has no room, then a new collectioncan be created.

In some implementations, a 1:1 correspondence of a maximum number ofrays in a collection to number of test cells 310 a-310 n is providedsuch that all the rays of a collection can be tested in parallel againsta given GAD element, which can include an architecture where thethroughput generally is around what can be obtained with 1:1correspondence of rays to test cells, but which can provide for asequential passing of a packet (e.g., information indicative of acollection, as described above) among different test cells, such thatdifferent test cells can be testing rays from different packets, eventhough overall the rays of a given collection can be viewed as beingtested in parallel.

Thereafter, rays are tested for intersection with the primitive providedto the test cells (i.e., each test cell has a different ray and teststhat ray with a common primitive, in this example.) After testing, eachtest cell indicates detected intersections.

Each ray of the collection is tested in its test cell for intersectionwith the GAD element provided to the test cells (e.g., in the multiplebank example of FIG. 5 (regions 578 and 579 illustrated), rays can beconsidered localized to a GAD element test region and/or a primitivetest region, for example, such that a bank serves one or more testers ofeach kind with ray data).

Because the output from testing rays for intersection with GAD elementsdiffers from testing the same rays for primitive intersection (i.e.,intersection with a GAD element results in collection into a collectionfor that GAD element, while intersection with a primitive results indetermination of a closest intersection with that primitive, and outputof such intersection), conflicts to write back collection data or outputintersections should not normally occur, even where a particular rayhappens to be in two collections being tested in parallel. If furtherparallelism were to be implemented, for example, by testing multiplecollections of rays for primitive intersection in multipleinstantiations of test cells 340 a-340 n, then features can also beimplemented to enforce orderly completion of such testing, such asstorage of multiple intersections, or lock bits, and the like. And inthe case of the example of FIG. 5, where data for a given ray can beprovided from only one bank to one tester type (i.e., a given ray islocated in one memory bank), then multiple GAD testers, for example,would not be testing the same ray at the same time, thereby avoiding theissue of write back conflicts.

In sum, a method can include receiving rays, assigning them tocollections, selecting for test ready collections, where readiness canbe algorithmically determined, assigning rays of the selectedcollections to appropriate test cells and streaming appropriate geometryfor intersection test through the test cells. Outputs depend on whetherthe geometry are scene primitives or GAD elements. For rays testedagainst GAD elements, the GAD elements are identified based on graphconnection with the node associated with the collection being tested,and rays are added to collections associated with the GAD elements beingtested. The collections are reviewed for readiness and selected for testwhen ready. For ray intersections with primitives, a closestintersection is tracked with the ray. Because rays are tested whenassociated with ready collections, it is implicit that intersectiontesting for a particular ray is deferred until a collection with whichit is associated is determined ready for testing. Rays can be collectedcoincidentally into multiple collections, which allows such rays to betested against disparate portions of scene geometry (i.e., they need notbe tested in order of traversal).

As previously addressed, the ITU stores in a memory, informationrepresentative of rays previously received from the ray input. The ITU,for these rays, maintains an association of each ray with one or moreray collections of a plurality of collections. The ITU also maintainsindications of collection fullness for the plurality of collectionsstored in the memory. These indications may be respective flagsindicating full collections or may be numbers representing a number ofrays associated with a given collection. Further details, and otherexamples of implementations, and variations related to implementingtesting algorithms are provided in the related applications referencedabove, showing that the information presented literally here is not anexclusive treatment thereof.

As is apparent from the disclosures to this point, rays are loaded from(or accessed in) a memory based on information provided in a collectionof rays. Therefore, such loading may include determining respectivememory locations where data representative of each ray is stored. Suchdata may be comprised in that ray collection, e.g., a ray collection mayinclude a list of memory locations or other references to storage, atwhich ray data for the rays in that collection are stored. For example,a ray collection may comprise references to locations in a memory, e.g.,memory 340, or a bank of a memory (e.g., bank 510), or some otherimplementation; these references may be absolute, offset from a base, oranother suitable way to reference such data. These aspects weredescribed from the perspective that separate ray data and ray collectiondata were maintained. However, in some implementations, that separationneed not be so explicit or apparent, in that ray collection data and raydata can be maintained as a content associative database for example,where associations between collections and rays, and between collectionsand elements of GAD are maintained and used to identify rays associatedwith collections for test, and also elements of GAD associated with thecollections.

Also, apparent is that ray data would be “stationary” in test cells aseither primitives or GAD elements are cycled through the test cells.Other implementations are possible, as described in relatedapplications, but a principal focus of these disclosures is providingfor rays to be localized or otherwise stationary with test cells, whilegeometry is fetched and tested.

Aspects of such an implementation are presented with respect to FIG. 6.In particular, another implementation of intersection testing logic cancomprise a processor 605 comprising test control logic 603 (akin to testlogic 203 of FIG. 2) which includes a fetch unit 620 for coupling to amemory interface 625, an instruction cache 630, an instruction decoder645, and a data cache 650. Data cache 650 feeds test cells 610 a-610 n.Instruction decoder 645 also provides input to test cells 610 a-610 n.An instruction generator 665 provides instruction input to instructiondecode 645. Test cells output indications of detected intersections towrite back unit 660, which in turn can store data in data cache 650.Output from write back unit 660 is also used as input to instructiongenerator 665 when generating instructions. It is contemplated thatinstructions used in such a processor 605 may be of a singleinstruction, multiple data variety, where the instructions processed inthe test cells are intersection tests between defined surfaces (e.g.,primitives and GAD elements) and rays.

In an example, the “instruction” may include data defining a geometricshape, such as a primitive or an element of GAD, and the multiple dataelements may include separate references for rays for testing againstthe geometric shape provided as the “instruction.” As such, thecombination the geometric shape and the multiple ray references can beconsidered a discrete packet of information deliverable to multiple ofthe illustrated test cells. In some cases, the packet delivery canproceed sequentially, such that multiple packets are “in flight” amongthe plurality of test cells.

Such test cells can exist in the context of a full-featured processorwith a large instruction set, and each such packet may thus includeother information sufficient to distinguish the purpose of the packet.For example, there may be a number of bits included to differentiate apacket formulated for intersection testing from packets existing forother purposes, for which different operations will be performed. Also,a variety of intersection test instructions may be provided, includingfor different primitive shapes and different GAD element shapes, or evenfor different testing algorithms, as appropriate.

In a typical example, each intersection test packet initially cancontain a reference to a geometry element, or data for the geometryelement, either being an element of GAD or a reference to a primitive,and references to a number of rays to test for intersection with thegeometry element (i.e., the “packet” described above).

Decoder 645 can interprets the instruction to determine the reference tothe geometry element, and initiates a fetch of the element through fetch620 (control for a memory interface, such as memory interface 625). Insome implementations, decoder 645 can lookahead a number of instructionsto initiate fetching of geometry elements needed in the future. Thegeometry element can be provided by fetch 620 to decoder 645, wheredecoder 645 provides the geometry element to test cells 610 a-610 n.

Decoder 645 also provides the ray references from the instruction asfunctional addresses to data cache 650, which provides respective datasufficient for intersection testing of each ray to each of test cell 610a-610 n. Data associated with the ray, which is not needed forintersection testing need not be provided. Thus, data cache 650 canserve as a localized ray data stored facility for one or more computingresources operating as intersection test cells.

The geometry element is tested for intersection with respective rays ineach test cell 610 a-610 n, and an indication of intersection is outputfrom each test cell 610 a-610 n for receipt by write back 660. Dependingon the nature of the geometry element tested, write back 660 performsone of two different functions. Where test cells 610 a-610 n weretesting a primitive for intersection, write back 660 outputs indicationsof each ray that intersected the primitive being tested. Where testcells 610 a-610 n were testing an element of GAD, write back providesthe outputs of test cells 610 a-610 n to instruction unit 665.

Instruction unit 665 operates to assemble future instructions that willinstruct test cells in further intersection testing. Instruction unit665 operates with test cell 610 a-610 n input specifying which raysintersected a given element of GAD, instruction cache 630 and withinputs from GAD input 670, as follows. With the inputs from test cells610 a-610 n, instruction unit 665 determines, based on GAD inputs,elements of GAD that are connected to the element of GAD specified inthe inputs from the test cells 610 a-610 n (i.e., instruction unit 665determines what GAD elements should be tested next based on anintersection indicated for a given GAD element).

Instruction unit 665 determines whether an instruction stored ininstruction cache 630 already exists for each element of GAD identifiedas connecting to the intersected element, and whether that instructioncan accept any further ray references (i.e., are all data slots of theinstruction filled?). Instruction unit 665 adds as many of the raysidentified as intersecting in the test cell input to that instructionand creates other instructions sufficient for receiving the remainingray references. Instruction unit 665 does this for each element of GADidentified as connecting with the element identified in the test cellinput. Thus, after processing the test cell input (an intersectionindication), rays identified as intersecting the same GAD element areeach added to instructions specifying testing of the rays againstelements of GAD connected to that same GAD element. The instructionscreated thereby may be stored in instruction cache 630.

Instructions may be organized in the instruction cache 630 based on theorganization of the elements of GAD received from GAD input 670.Instruction unit 665 performs functions similar to logic 203 a, in thatboth logic 203 a and instruction unit 665 receive indications of whatrays hit what GAD elements, grouping such rays together for futuretesting. The system of FIG. 6 is intended to be more general purpose, inthat packets of rays for testing can be a type of packet from among manytypes for accomplishing different functions.

For example, GAD input 670 may provide a graph of GAD, where nodes ofthe graph represents elements of GAD, and pairs of nodes are connectedby edges. The edges identify which nodes are connected to which othernodes, and instruction unit 665 may search instruction cache 630 byfollowing edges connecting nodes, in order to identify whichinstructions are already in the cache for a given element of GAD, andwhere new rays may be added. Where multiple instructions exist for agiven GAD element, they may be linked in a list, or otherwise ordered orassociated with each other. Other methods, such as hashing a GAD elementID to identify potential locations in instruction cache 630 whererelevant instructions may be found can also be implemented.

Instructions can also reference a node of GAD under test, such that theinstruction would cause fetching of connected nodes of GAD, in responseto the instruction being issued and decoded (as opposed to storinginstructions for each connected node). Each such connected node can bestreamed through test cells 610 a-610 n for test with respective raysmaintained in each test cell (i.e., ray data remains stationary in testcells while a plurality of GAD elements are provided to each of the testcells, and each test cell tests its ray against each GAD element insequence).

Thus, a processor implemented according to these examples would providefunctionality to obtain or otherwise create instructions that collectrays identified for intersection with a first node for intersection testagainst connected nodes. As with the examples described above, if theGAD provided to processor 605 is hierarchical, then the graph of GAD maybe traversed in hierarchical order.

The example connections and sources of GAD are exemplary and otherarrangements are possible. For example, memory 615 may be a source forGAD elements, however it continues to be preferable to store rays (i.e.,data defining the rays, and other data, such as a current closestprimitive intersection found) in a faster memory than geometry data,where a given processing architecture permits. Also, in the aboveexample, next nodes (i.e., next acceleration elements, or primitives) tobe tested based on testing results were determined and packets wereinstantiated per geometric shape responsively. Other implementationsapparent from these disclosures can include instantiating packets per“child” node upon determining to initiate testing of children of a givennode, which creates child instructions/collections later in time.

FIG. 7 further illustrates aspects of ray tracing systems (e.g. system700) that can use queues for decoupling operation of intersectiontesting and ray shading, including generation of new rays, includingcamera rays. System 700 allows submission of rays for intersectiontesting and their completion of intersection testing, resulting inoutput for shading, in different orders, like the systems of FIGS. 1-6.Likewise, the intersection testing resources can proceed withintersection testing rays without stalling for shading resolution of apreviously-identified intersection.

FIG. 7 illustrates a plurality of intersection testing resources (ITRs)705 a-705 n, each respectively coupled to ray data storage 766 a-766 n,which store data defining rays to be tested for intersection in thatresource. Each group of ITR and ray data storage (e.g., ray data 766 aand ITR 705 a) can be viewed as a localized grouping of test resourcesand ray data storage, e.g., grouping 704 illustrated, which is similarto previous groupings, e.g., groupings 578 and 579 of FIG. 5.

Ray data storage 766 a-766 n can be memories, such as private L1 caches,shared or mapped portions of L2 caches, or the like. As in previousexamples, it is preferable to devote fast memory to storing ray datalocally to specific processing resources, rather than geometry data. Thelocalized storage of ray data is made easier by intersection testingalgorithms used here, which increase a length of time a ray can bestored in a more localized, faster memory, which reduces the amount ofthrashing of this smaller memory. As such, this ray storage can beviewed as being quasistatic, in that data for a given ray is usuallystored in the same local memory until it has completed intersectiontesting in the scene.

Data defining rays is loaded via output 743 from test control 703(similar to logic 203 b, et al. in previous figures). Test control 703receives inputs comprising identifiers for rays that have completedintersection testing in the ITRs 705 a-705 n through ray complete queue730.

Queue 730 stores ray identifiers (some example Ray IDs 1, 18, 106, and480 are illustrated). Queue 730 gets inputs from ITRs 705 a-705 n, thatrepresent rays completing testing in the scene, having been tested toidentify a closest intersection that it intersected. As such, queue 730can be fed from a decision point 751 that can determine whether a givenoutput from ITRs 705 a-705 n represents information for a GAD element ora closest possible primitive intersection (useful where ITRs 705 a-705 ncan test both types of shapes).

Decision point 751 thus represents two types of intersection controlfunctions described previously. One is that GAD/ray intersections areretained/managed closer to the intersection testers; the other is thatonly closest detected primitive/ray intersections are outputted forshading. If in some previous architectures, separate test cells are usedfor each, then the decision point may only track when a closest possibleprimitive intersection has been found.

From decision point 751, GAD results enter mux 752 that also receivesray ID inputs from queue 725, which stores ray IDs received from input742, which in turn is fed from ray control 703. Ray control 703populates input 742 with ray identifiers corresponding to rayinformation being supplied to ray data 766 a-766 n through output 743from test control 703. Thus, data defining rays identified in queue 725(by ray identifiers (ray IDs)) are provided via output 743 to ray data766 a-766 n for storage in those memories. Examples of how ray IDs canbe formed are provided below.

Both queues 730 and 725 illustrate a series of identifiers for rays (RayIDs). However, as will be described below, rays generally are testedconcurrently against a given geometric shape. Thus, queue 725 in suchcases preferably would be storing ray IDs for a packet of ray IDs, andso the queue 730 also can represent a series of entries each having anumber of ray IDs associated with a given shape.

By particular example, algorithms driving this architecture generallywait until it has been determined that a number of rays need to betested against a given shape, then such testing is performed and resultsoutputted, so it is generally contemplated that numbers of rays will becompleting testing and beginning testing around the same time.Beneficially, these completing rays can be completely unrelated to eachother in terms of how or when they were instantiated initially, or bywhat path they traversed an acceleration hierarchy. Conversely, queue725 can be considered to contain groups or packets of new rays that areto be tested against a default GAD element of the scene, e.g., a rootnode of a hierarchy of GAD elements.

Such new rays come from ray sources, including a camera shader 735, andother shaders 710 a-710 n. Camera shader 735 is identified separately,as it generates primary rays to be tested in the scene. Shaders 710a-710 n run on computing resources, such as in threads, and/or cores ofone or more processors and represent execution of instructions or otherlogic specifying what response is appropriate to an identifiedintersection between a ray and a primitive. Usually, such response isdetermined at least in part by shading code associated with theprimitive; various other influences and considerations can be accountedfor.

Shaders 710 a-710 n receive identifiers of rays and primitivesintersected through distribution point 772, which receives such ray datafrom output 745 of test control 703 (see FIG. 8 a). Distribution point772 can be used to provide such ray data to compute resources havingavailability to execute code for a given primitive, and so any means forsuch an availability determination can be used to control suchdistribution, including load measurements, flags set by the computeresources, a decoupling FIFO with a fullness indicator, or even a roundrobin or pseudo random distribution scheme can be used.

Outputs of these shaders 710 a-710 n can include other rays, calledsecondary rays for convenience (outputs from camera 735 also includerays). In this example, such rays would, at this point, include at leastorigin and direction data defining them, but would not at this pointneed to have an associated ray ID, which preferably will be provided bytest control 703.

As can be discerned, test control 703 can monitor ray state in theintersection testing resources, allocating new rays to replace rays inray data 766 a-766 n that have completed, as described in more detailwith respect to FIGS. 8-9. Distribution of ray IDs to ITRs 705 a-705 nis performed by distributor 780, described in detail with respect toFIG. 10. Such distribution is primarily controlled by which memories ofray data 766 a-766 n store data defining a ray identified by a givenidentifier. Also, distributor 780 controls when ray IDs are obtainedfrom queue 725, based on considerations such as collection readiness, asalso described with respect to FIG. 10.

Now, turning to FIG. 8 a, there is illustrated a portion of test control703, comprising banks of memory associated with each of Ray Data 766a-766 n, each bank having slots for populating with ray data, andaddressable by memory addresses. FIG. 8 a illustrates that output 744from ray complete queue 730 includes ray identifiers 1, 18, 106, and480, each of which have spaces allocated in memory 803. Such spaces areallowed to be overwritten/filled in response to reception of these rayidentifiers from output 744. Output 745 to distribution point 772includes ray data for use in shading. Output 745 may also include otherdata. In practice, memory 803 may be implemented in a memory used alsoby other processes, such as processes executing shaders 710 a-710 n. Insuch cases, output 745 can represent (or be implemented by) retrieval ofsuch data from memory 803 by a computing resource.

A variety of communication links were identified in FIG. 7, such aslinks 741, 742, 743, 744, 745, 750, 790; any of these links can beimplemented according to an overall architecture implementation, and caninclude shared memory regions, physical links, virtual channelsestablished over expansion busses, shared register spaces, and so on.

FIG. 8 b illustrates that data for new rays comes in from output 741(from shading operations, e.g., such as camera shader 735). Such raydata at least includes ray origin and direction information. Now, testcontrol 703 assigns these new rays to locations in memory 803 that arefor different of the ray data 766 a-766 n. The identifier associatedwith each ray origin and direction depends on where it was stored. Thus,input 742 (input with respect to queue 725) receives ray identifiersdetermined on that basis. Also, output 743 includes both the rayidentifiers and their associated origin and direction information storedin memory 803. The assignment of ray IDs illustrated in FIGS. 8 a and 8b is convenient, in that a ray ID can be used to index a memory toidentify relevant data, but any other kind of identifier for a ray canbe used, so long as ultimately an identification of ray data in ITRs 705a-705 n and in memory 803 can be effected using the ray identifyingdata.

FIG. 9 a illustrates an example of such an alternative where a contentassociative memory 910 maintains keys 905 that are each associated withdifferent ray data.

FIG. 9 b illustrates that within each ray data 766 a-766 n, slots areprovided to accept ray data from test control 703 via interface 743.These slots can be further subdivided into multiple banks, orinterleaved, and/or other cache organization mechanisms for allowingeasier retrieval of data from the cache. Where rays need to bedistributed for storage herein, such distribution can proceed based onleast significant bits of a ray ID or of a hash of the ray ID, or bymodulo division with a number of banks into which distribution is tooccur, by round robin queuing, or any other distribution mechanism thatcan be used to distribute ray data to the memories. Within any givenportion, ray data also can be sorted based on ray ID.

In sum, FIGS. 7-9 b illustrate an architecture where rays to be testedare collected by control logic, and assigned identifiers that preferablyare based on memory locations at which ray definition data will bestored in respective caches coupled to different intersection testingresources. Primitive intersection testing results come from thesetesting resources as they complete, and the test control logic can thenreassign memory locations for those completed rays to new rays needingto be tested. Completed rays can be shared on any of a plurality ofdifferent intersection processing/shading resources, which can generatefurther rays to be tested. Rays are generally cycled through theintersection testing resources throughout traversal of an accelerationstructure and until a closest primitive intersection is identified (oruntil it is determined that the ray fails to intersect anything otherthan a scene background).

Turning to FIG. 10, there is illustrated further architecture aspectsfor rendering systems. One aspect in FIG. 10 is that ray data can bestored in respective cache memories coupled to processors configured forintersection testing. Another aspect is how distributor 780 caninterface with ITRs 705 a-705 n. A further aspect illustrated is howshape data for testing can be provided to the intersection testers.

Distributor 780 receives ray identifiers from mux 752 (FIG. 7) throughcommunication link 790 (implemented as hardware, interprocess orinterthread communication, or the like). These ray IDs are eachtransmitted to collection management 1075, where an association betweenthe ray IDs and the respective GAD element bounding objects to be testednext is maintained. The ray IDs also can be distributed by decisions1013, 1014 and 1015 among queues 1021, 1022, and 1023 where the ray IDsawait a determination from collection management and storage 1075 totest their collection. For example, collection 1045 has been determinedready to test and the ray IDs are dispatched to respective ITRs 705a-705 n whose caches 1065 a-1065 n contain data for each such ray ID.Collection management 1075 also may have an interface to a memorystoring GAD element data and/or primitive data in order to initiateretrieval of the geometric shapes needed for testing.

These shapes are arriving in a queue 1040 from storage 103 (FIG. 1) vialink 112 (for example). These shapes were identified based onassociation with an element of GAD associated with a given collection.For example, in a case of hierarchical GAD, these shapes can be childrenof a parent GAD element. Each ITR can test its ray serially against theshapes from queue 1040. Thus, highest throughput is achieved when raysof a given collection are equally distributed among caches 1065 a-1065n, and collection management 1075 can update collections based onresults of testing a given ray collection most easily. When multiplerays of a given collection are in one cache, then the other intersectiontesters can stall, or they can test rays from a next collection. Amaximum number of out of order tests can be accommodated beforecollection testing synchronization is again required.

Outputs are produced at outputs 750 a-750 n (that can be components oflink 750 (FIG. 7), which are provided to decision point 751 (FIG. 7). Asdiscussed above, this architecture provides for ITRs testing any shape(i.e., either primitives or GAD elements). Also, decision point 751,coupled with collection management 1075, represents that a result of GADintersection testing includes a determination that a given ray hit agiven GAD element, which causes an identified ray to be added to acollection corresponding to that GAD element. Thus, anotherimplementations can include providing GAD testing results directly tocollection management 1075. More generally, the described examplesexemplify potential flow of information, and other flows would beapparent therefrom.

Other aspects to note are that more than one ray ID for a given raycollection can be stored in any of queues 1021, 1022, 1023 (shown bycollection 1047). In such cases, the ITR for that queue can test bothrays, and output results for the second test (or however many subsequenttests) as they become available. Decision point 751 can wait for allresults of a collection to be assembled, or the “straggler” result canbe propagated as available.

In sum, FIG. 10 illustrates a system organization allowing a packet ofray identifiers associated with one or more shapes to be distributedinto queues for a plurality of testing resources, that each store asubset of ray data. Each test resource fetches ray data identified byeach ray identifier against a shape loaded to the test resource.Preferably, the shapes can be streamed sequentially through all the testresources concurrently. The shapes can be identified as a sequence ofchildren starting at an address in a main memory. Thus, FIG. 10illustrates a system organization where a shape generally is testedconcurrently against multiple rays.

However, other examples provide for testing a shape sequentially in aseries of different intersection testing resources, where shape data anda packet of ray identifiers travel among intersection testing resources.By having a plurality of packets in flight, throughput of testing isincreased. Examples according to this approach are described below.

FIG. 11 illustrates a first example of a computer architecture in whicha ring bus arrangement of a plurality of computer resources 1104-1108can be implemented. Each computer resource has access to a private L1cache 1125 a-1125 n, which, for any compute resource used forintersection testing, contains ray data that will be intersection testedwith geometric shapes provided to that computing resource from shapedata storage 1115 in memory 340. Communication among compute resources1104-1108 can occur by bus 1106, which may comprise a plurality of pointto point links or any other architecture available for suchinter-processor communication.

If compute resources share certain memory structures, such as L2 caches1130 and 1135, then communication between those compute resources, e.g.,compute resources 1107 and 1106 sharing L2 cache 1130, may communicatewith each other through that cache for some purposes. Additionally, acopy of data for rays being tested in the system may be maintained inray data 1110, for distribution of subsets thereof among ray data 1110a-1110 n, such ray data may be transmitted through L2 1130 and L2 1135,and larger portions thereof also may be stored in those L2 caches (asdescribed below). Shape data 1115 also may reside in memory 340, andtemporary reside in one or more of L2 1130 1135 and any of the caches1125 a-1125 n. However, ray data stored in such caches is protected frombeing overwritten by such shape data, and an amount of space allocatedfor such shapes generally is limited to what is useful for ray packetscurrently identified as being ready for test, enough to shield latencyto shape data 1115, without attempting to keep shape data around withoutany indication of when it will be used next in testing. In other words,it is preferred to avoid using typical cache management algorithms, suchas least recently used replacement, for ray data.

FIG. 11 also illustrates that an application and/or a driver 1120 canexecute on compute resource 1104, in addition to intersection testing.Also, a ray process 1121 can execute on compute resource 1108, andpacket data 1116 can be stored in cache 1125 a for use by the packetprocess 1121. Other packet data can be stored in L2 1129, but it ispreferred to store packet data in the fastest possible memory, similarto ray data. The packet process performs many of the same functions thatcollection and other management logic performed in prior figures,namely, keeping track of which rays have intersected which GAD elements,and selecting GAD elements which are ready to test, e.g., by virtue ofhaving enough rays ready to be tested against children of theintersected GAD element, for example.

Since in this example, packet process 1121 is centralized, it wouldoperate by issuing a packet containing a plurality of ray identifiersand either a reference to shape(s) or data for shape(s) to be tested forintersection with the identified rays. Each compute resource 1104-1107performing intersection testing receives the packet. For example,sequentially in a plurality of point to point links (explained furtherbelow) or generally at the same time in a shared bus type medium (whichcan be similar to the architecture of FIG. 10). Each compute resource1104-1107 determines whether its localized ray data 1110 a-1110 n storesdata for any ray identified in the packet, and if so retrieves data forthat ray, tests it and outputs results.

Since results for GAD element intersections are tracked by packetprocess 1121, any communication mechanism to get such results back topacket process 1121 is acceptable. Such mechanism can be selected basedon the overall architecture of the system. Some examples approaches areillustrated below, and can include a separate indication for eachintersection found, or allowing each test resource to populate acirculating packet with intersection results.

FIG. 12 illustrates a further example of an organization of computeresources 1205-1208, associated caches 1281-1284, which each store raydata 1266 a-1266 n and packet data 1216 a-1216 n. Each compute resource1205-1208 is connected to at least one other compute resource by queues1251-1254. Ray process 1210 provides inputs through queue 1250 tocompute resource 1205. Ray process 1210 communicates withapplication/driver 1202. An output 1255 from compute resource 1208communicates with ray process 1210. Another output 1256 communicateswith compute resource 1205. Primitive and GAD storage 103 provides readaccess to that shape data for compute resources 1205-1208.

Ray process 1210 receives or creates rays for testing, and forms packetscontaining ray identifiers and ray data for the identified rays. Thepackets are passed through the queues 1250-1254 to each of the computeresources 1205-1208. Each compute resource 1205-1208 takes a portion ofthe rays in a given packet, in some examples, just one ray, and storesits portion of rays in its ray data 1266 a-1266 n. Other examples caninclude sending packets destined for a particular compute resource1205-1208, such that ray process 1210 determines what ray data will bestored in what localized ray data 1266 a-1266 n.

After rays are loaded in localized storage, they are thereafteridentified by packets containing ray IDs only, without origin anddirection data. Such packets also contain either a reference to a shapeor data for a shape to be tested against rays identified in that packet.In some examples, data for forming such packets is distributed among thelocalized memories 1281-1284 of compute resources 1205-1208. Thus, eachof the compute resources 1205-1208 maintain a portion of the packet datafor rays being tested in the system at a given time, such thatinformation concerning what rays are to be tested against what shapesnext is distributed. Thus, each compute resource 1205-1208 can issuepackets of ray IDs and shape information to initiate testing of acollection ready for test.

Each packet makes a round through the queues and computing resources,and then is forwarded back to the originating compute resource with theresults of intersection testing populated in it. In one implementation,each compute resource 1205-1208 fetches shape data for packets that itwill issue. For example, if compute resource 1205 has a packet ready fortest (e.g., a collection of rays for a given GAD element), then thecompute resource can fetch shapes to be tested by such association(e.g., children of the GAD element), make a packet having data for eachshape, and send each packet out of queue 1251.

In turn, compute resource 1205 receives each packet that it emitted,after the packet has traveled through the other compute resources. Whenreceived, each packet is populated with results of testing a shape inthat packet (reference or definitional data) for intersection with raysidentified in the packet that were/are stored in the other computeresources 1206-1208. Compute resource 1205 can test any identified raysit has locally in ray data 1266 a either before or after the othercompute resources perform their testing. Thus, ray definition data canbe distributed among a plurality of fast memories, coupled tointersection testing resources, and the testing results can be collectedin a distributed manner.

Implementing an architecture in accordance with FIG. 12 may take intoaccount various characteristics of a physical system being used. Forexample, queues were shown as sending packets in one direction. However,benefit may be realized by sending packets in two both directions (i.e.,bidirectional queues or multiple queues). Also, FIG. 12 illustrates thatpacket data is dispersed among compute resources, allowing moredispersed memory accesses to more L2 caches, and potentially other portsto a larger memory, such as main memory 103.

If packet data were centralized, then a packet sent in one directionwith a data reference can have data fetched by, for example, computeresource 1205, and a packet sent in the other direction with a datareference can have data fetched by compute resource 1208. This situationcan be generalized to provide any entry point into such a ringbusarchitecture (unidirectional or bidirectional).

As evident from the disclosure, the queues described may include one ormore queues that are for introducing new rays for intersection testinginto a system comprising a plurality of intersection testing resources,and queues that interconnect the intersection testing resources witheach other. In some cases, queues that introduce new rays can containray definition data (e.g., queues that wait to store data in cachesconnected to intersection testing resources). Such queues can beimplemented as lists in a main memory storing ray definition data.Queues interconnecting intersection testing resources for passingpackets preferably include only ray identifiers and not ray definitiondata.

FIG. 13 illustrates a portion of a potential implementation of system1200, where compute resources may be implemented with cores of a chip,such that compute resource 1205 is one core and compute resource 1206 isanother, where queue 1251 is intercore communication. Also illustratesis an intermediate L2 cache 1305 that can store ray data, as well asshape data. As described with respect to previous figures L2 cache 1305may store some portion of scene geometry and acceleration data, so longas by storing such data, there is not an increase in thrashing of raydata (i.e., ray data preferably is given prority in cache storage).

FIGS. 14 a-14 c each illustrate various relationships that queuesaccording to various implementations of exemplary systems can take.Generally, inter-compute resource communication does not need to beserial or 1:1. For example, FIG. 14 a illustrates a one input 1404 canfeed both queues 1405 and 1406, which can each be dedicated to onecompute 1407 and 1408 respectively. For example, where compute 1407 and1408 are implemented on a single physical chip, then input 1404 can be achip level input and each queue 1405 1406 can be for a particular core.

FIG. 14 b illustrates that a single input can feed multiple cores, whicheach can feed compute 1407 1408, which each also can send data to anopposite queue 1406 1405 respectively. FIG. 14 c illustrates that queue1411 can receive input 1410, and provide outputs to both compute 1407and 1408. Thus, FIGS. 14 a-14 c illustrate that various queuingstrategies can be implemented for passing packets according to theseaspects.

FIG. 15 is for illustrating that where multiple levels of cachehierarchy exist (e.g., level 1 caches 1502 and 1503, and level 2 cache1504, various combinations of ray data can be provided. For example, raydata 1507 can include disjoint subsets of ray data 1505 and 1506, aswell as other ray data not present in either 1505 or 1506. Ray data 1505and 1506 can vary dynamically, such as where one queue feeds more thanone compute resource (FIG. 14 c), then ray data may reflect a dynamicassignment of a ray stored in ray data 1507 to either ray data 1505 or1506.

FIG. 16 illustrates in more detail an example implementation of a queue1251 and data that it can store. Packets 1601 a-1601 n are illustrated,each having respective ray identifiers 1605 a-1605 p, 1606 a-1606 p, and1607 a-1607 p, and corresponding hit information fields 1610 a-1610 p,1611 a-1611 p, and 1612 a-1612 p. Packet 1601 a contains data 1615 a forshape 1, packet 1601 b contains data 1615 b for shape 2, and packet 1601n contains data 1615 n for shape n. As can be discerned queue 1251 isfed by compute resource 1205 and read by compute resource 1206. Ofcourse, various other queuing strategies, some of which are illustratedin FIGS. 14 a-14 c can be implemented.

Queuing as that term is used here does not imply a first in/first outrequirement for rays tested in any given compute resource. On average,rays identified in any given packet will be about evenly distributedamong localized ray storage for different compute resources, such thatany given packet should find its rays distributed among a number ofcompute resources, such that parallelism is achieved for each packet.Where a number of rays for one packet need to be tested in one computeresource, then a bubble may be formed where another compute resource hasno ray to intersect for that packet. Such a bubble can be filled byother computation, including other intersection testing of anotherpacket. In some examples, each compute resource can maintain state formultiple threads, and switch among threads on stall conditions for agiven packet. So long as critical data for each intersection testbetween the packets can be maintained in registers, then a netthroughput advantage should be realizable.

In partial summary of aspects of the operation of exemplary systems,each computer resource acts responsively to reception of a packet. Whena packet arrives from an input queue for a particular computer resource,the compute resource examines the ray identifiers in that packet, anddetermines which rays identified in that packet have data stored forthem in its respective memory. In other words, a packet can be formedwith ray identifiers without a priori knowledge of which computeresource contains or has fast access to ray data for the rays identifiedin the packet. Moreover, each computer resource does not responsivelyattempt to obtain ray data for all rays identified in a packet, butrather only determines whether it has ray data in its local fast memoryfor any ray identified in a packet, and tests only that ray(s) forintersection with identified shape(s).

FIG. 17 is for describing aspects of how a packet can be processed in anexample computer resource. FIG. 17 illustrates that packet 1601 a comesin to compute resource 1206. Computer resource 1206 queries its raydata, using the ray identifications from packet 1601 a (e.g., say thatray 1605 a has ray ID 31 and matches to ray ID 31 in ray data storage1266 b. The origin and direction associated with ray ID 31 is retrievedvia 1290. Also shape data, if identified in the packet, is obtained 1715from memory resource 1291 where it is currently stored. If shape data isprovided in the packet, then that shape data is used directly. Then theray 31 is tested 1720 for intersection with shape 1 (or shapes definedby the retrieved data).

If a shape tested was a GAD element (1725), then the effect of suchintersection testing is to determine a smaller subset of sceneprimitives that may still have the possibility of intersecting the raytested. Therefore, a positive hit result is written back 1726 to thepacket in location 1610 a for the ray identifier i.e., the identifierfor ray 31. In some implementations, since an emitter of a packet cantrack what ray IDs were emitted and in what order in a packet, onlyresults need be written back, with an implied order being the same asemission. Thus, after a pass through the testers, the packet emittingresource can process testing results.

On the other hand, if the shape tested was a primitive (1730), then anearest primitive intersection determination (1731) can be conducted todetermine whether this detected intersection is closer than any previousone. If it is, then the primitive intersected, and optionally theintersection distance can be stored with the packet or otherwiseoutputted. Since a given ray may be associated with multiple packets(i.e., with multiple GAD elements simultaneously), a count can bemaintained 1733 for when each time a ray is associated with a GADelement, such that the count can be decremented each time so that it canbe determined when the ray is no longer in any other packets stillneeding testing, allowing the memory devoted to that ray to be freed foradmission of another ray.

In sum, data associated with each ray in its local fast storagepreferably includes a closest detected primitive intersectionidentifier, that can include a primitive reference and a parameterizeddistance to that intersection. Other data associated with each rayincludes a count of GAD element ray collections in which that rayexists. After each collection has been tested, the count is decremented,and when another collection is created, the count is incremented. Whenthe count is zero, the primitive then identified as the closestintersected is the primitive determined to be intersected by that ray.

FIG. 18 a relates to an example Single Instruction Multiple Data (SIMD)architecture, which may be used in situations where a packet canidentify a start of a strip of geometric shapes for testing. In anexample, nodes of a GAD element graph are connected to one or more othernodes by edges, where each node is representative of an element ofgeometry acceleration data, such as a sphere or an axis aligned boundingbox. In some examples, the graph is hierarchical, such that upon testinga given node, children of the given node are known to bound selectionsof primitives that are also bounded by the parent node. GAD elementsultimately will bound a selection of primitives.

In implementations, a string of acceleration elements, which arechildren of a given element can be identified by a memory address of thefirst element in the string. Then the architecture can provide apredetermined stride length to data at the start of the next element. Aflag can be provided to indicate the end of a given string of elementswhich are children of a given node. Similarly, a strip of primitives canbe identified by a start memory address with a known stride length todefine the next primitive. More particularly to a triangle strip, twovertices in sequence can each define multiple triangles.

FIG. 18 a is used for illustrating aspects of a SIMD architecture, akinto the SIMD architecture illustrated with respect to FIG. 6. In thisexample, a packet 1601 a is received that contains multiple rayidentifiers 1605 a-1605 n, optionally spaces for storing receivingintersection testing results 1610 a-1610 n, and shape data that cancomprise shape definition data, an identifier for a shape, or anidentifier 1815 a for a beginning of a strip of shapes (e.g., triangleprimitives) to be tested.

This example architecture may be appropriate where fewer, more powerfuldistinct processing resources with larger caches are used forintersection testing. Here, it would be expected that each distinctprocessing resource would have, on average, a number of rays in itslocal storage about equal to a number of rays that can be tested by aSIMD instruction (by contrast, FIG. 10 illustrated an example where eachcache would preferably have one ray for each collection). For example,if four rays could be tested at a time in a SIMD execution unit, then itwould be preferable to have statistically about four rays in a localstorage for that SIMD unit in each packet being passed around. Forexample, if four distinct processing resources are provided, and eachhas a SIMD unit capable of testing four rays, then a packet can haveabout 16 rays referenced. Alternatively, a separate packet can beprovided for each processing resource with a SIMD unit, such that forexample, a packet can have 4 rays referenced where there is a 4×SIMDunit.

In one example, a first compute resource 1205 receiving packet 1601 acan use identifier 1815 a for obtaining data for the strip of shapes.Then each ray referenced in packet 1601 a stored in ray data 1266 a istested in computation units 1818 a-1818 d. In the shape strip example,shape strip 1816 is retrieved, and comprises shapes 1-4. Each shape canbe streamed through each computation unit 1818 a-1818 d, testing eachfor intersection with the ray loaded into that unit. For each shape ofthe strip, the computer resource can formulate packets (packet 1820illustrated) that each contain results of testing the rays against oneof the shapes.

Alternatively, separate bits can be provided in the results section foreach ray to accept intersection results, and one packet can be passed.To avoid fetching again from slow memory, this approach is expected tobe most appropriate where multiple compute resources can share an L2, orwhere a fetch by the first compute resource causes transfer of shapedata to the other compute resources as well. For example, a DMAtransaction can have multiple targets, each being a different computeresource needing to receive a given stream of shapes to be tested, is anexample of an appropriate memory transaction model for someimplementations. A principal consideration is to reduce fetching thesame data from a main memory 103 more than once.

As discussed previously, each intersection testing resource determineswhich ray identifiers have ray data stored in its ray data storage. Forany such rays, the ray origin and direction are retrieved. Previously,examples provided that a testing resource can test a given identifiedray with a sequence of one or more identified shapes. However, it may bethe case that a processing resource can test a plurality of shapes forintersection with a given ray concurrently without substantial extralatency, or a plurality of rays with one shape, or a combination of thetwo. In FIG. 18 a, a SIMD architecture is shown wherein within onecomputing resource configured for intersection testing, each of fourSIMD units can test a different ray for intersection with shapessequentially provided to it. The sequence of shapes can be fetched basedon a shape strip reference used as an index to scene data storage 340 toinitiate retrieval of a series of shapes, which are each tested in acomputation unit 123 or four.

Preferably, rays are collected into collections based on detectedintersections between collected rays and elements of acceleration data.So, in this example, where a different ray is tested in each SIMD unitagainst 4 different shapes, the computing resource containing the SIMDunits can reformat the results into packets of rays, each referencing ashape.

Other architectures using SIMD units can instead provide fetching aplurality of rays collected into a collection. As discussed, such raysare to be tested for intersection next against shapes related to theshape associated with the collection. For example, there may be 16 or 32shapes connected to the collected-against shape. A first subset of theseshapes can be loaded into different SIMD units, and the collected rayscan be streamed through each SIMD unit (i.e., the same rays go througheach SIMD unit at the same time). Results packets can be formed by eachSIMD unit independently, and next shapes loaded into the SIMD units. Therays can then be recycled through the SIMD units. This process cancontinue until all related shapes have been tested against the collectedrays.

FIG. 18 b illustrates a time-based progression for computation unit 1818a for such an example. At time 1, shape 1 and ray 1 are tested. Thereshapes are numbered from 1 to q and the rays from the collection arenumbered 1 to n. At time n, shape 1 and ray n are tested. At the startof the next cycle (time q−1*n+1), the last shape begins testing incomputation unit 1818 a

FIG. 19 illustrates aspects of how a packet 1905 can be dispersed forintersection testing among computing resources and testing results thatare each ultimately coalesced in a compute resource 1910 that maintainsa memory for rays of packets associated with the shape identified 1905.FIG. 19 illustrates an example system state during processing. Inparticular, compute resources 1910-1914 each have received ray IDinformation for a ray stored in a memory accessible to that computeresource, have tested the identified shape for intersection and haveoutputted results 1915-1919, which includes identified hits 1915, 1917,1919. Either hit or miss can be a default behavior, such that a miss forexample would not be indicated by a positive value, or the default valuein the packet can be set to miss. After the testing, compute resource1910 collects at least the hit information; here compute resource 1910could be managing all packet information in the testing system, or asubset thereof, including for this particular shape.

An example organization of a memory 1966 shows a logical organization ofshape references mapped to a number of ray IDs: ray A, B, etc. Alsoillustrated is that some slots for the row related to Ref #1 (i.e., areference to the shape under test) are empty. Thus, when computeresource 1910 receives hit results, it first populates remaining emptyslots of the given Ref #1 collection, then it is illustrated in 1966that Ray n begins a new packet for Ref #1 within memory 1966. Now, sincethe packet for Ref #1 is full, this packet can be determined ready fortest. In some examples, child GAD elements of the shape referenced byRef #1 are fetched, and a packet is formed with all the rays associatedwith Ref #1 in each packet. For example, there could be 32 children ofRef #1, and thus, 32 packets could be formed, with packets 1922-1924illustrated. In some examples, compute resource 1910 can fetch datadefining the child shapes and store that data in packets 1922-1924.Alternatively, references allowing other compute resources to fetch suchdata can be provided.

In some cases, compute resource 1910 may also be storing a rayidentified within the packets created, and so may first test that raybefore sending the packets out. In such cases, compute resource 1910 maystore the shape data already fetched in the sent out packets. Asdiscussed with respect to FIG. 12, implementations may allow sendingsuch packets to one or more other compute resources, e.g.,bi-directional queuing, or any-to-any, etc.

FIG. 20 is for explaining some examples of how methods according thedescribed aspects can be implemented. A packet is emitted 2005 withshape information, ray IDs and locations where hit information can bewritten back, the hit information can be zero'ed or otherwise a “don'tcare” at this point. A first test is conducted 2006 for ray 1 ID, andfound to hit, so a 1 is written to the packet, the packet is passed fora second test 2007, where ray 3 was found to be localized for the secondtest, and it was found to have missed, so a 0 is written (ormaintained), the hit information from test 2006 is carried forward inthe packet (i.e., rays in the packet can be tested out of order). Athird test 2008 is conducted, for ray 2, and found to hit. This exampleshows that rays in a packet can be tested out of an order presented inthe packet, and an order of testing depends on what tester was best ableto access ray data for a given ray ID. Testing continues (2009) untilall ray IDs have been tested. Then, the packet can be coalesced 2015,meaning that only hit information needs to be maintained. Suchcoalescing can occur at a compute resource that emitted the packet. Newhit results can be combined with hit results from a previously existingpacket (see FIG. 19). Then, it can be determined 2025 whether thecollection of rays in the packet is ready to test (e.g., based onfullness). If not, then a different packet can be processed 2040. If so,then child shapes of the shape associated with the packet can be fetched2030, where parent node 2041 is the shape and children of that node areidentified by 2042, for example. Then, new packets can be spawned 2035for each child shape with ray identifiers from the packet associatedwith the parent.

FIG. 21 helps summarize method aspects described above, in the contextof systems that can be used to implement them. In particular, FIG. 21depicts that method 2100 comprises storing primitives and GAD elementsin a main memory (2105), and defining (2110) rays for intersectiontesting using ray definition data (e.g., origin and directioninformation). Each ray is made identifiable with an identifier (2115).Subsets of the ray definition data is stored (2120) in localizedmemories associated with respective processing resources of a pluralityof such resources. Rays are scheduled for testing by distributing (2125)identifiers for those rays, and shape data among the processingresources. The rays are tested in processing resources that havedefinition data for those rays stored locally (2130). In somesituations, each ray may have definition data in only one local memory.

Indications of intersections between rays and primitives arecommunicated (2135) from the first subset of computing resources to thesecond. The second subset shades (2140) the intersections. The shadingcan result in new rays, for which definition data is distributed 2145among the localized memories, preferably replacing definition data forcompleted rays. Those rays are then tested as above. The subsets ofcomputing resources can be implemented by instantiating or otherwiseallocating computing resources, which includes instantiating threads forexecuting on multithreaded processors or cores. The allocation can varyover time, and need not be a static allocation between resources forintersection testing and for shading. For example, a core executing athread of intersection testing can complete a series of intersectiontests, filling a memory space with a number of indications of rayintersections with primitives, then the core can switch to shading thoseintersections.

Some examples above were explained primarily from the perspective oftesting GAD elements for intersection, where results of such testing isgrouping of rays (via association of ray IDs with particular GADelements) against smaller and smaller groupings of primitives. It wasdisclosed that ultimately, a GAD element identified by testing willbound primitives that are to be tested against rays identified as beingpart of a group associated with that GAD element. For packets havingprimitives, the outcome of intersection testing is identifications ofray/primitive intersections, which are accounted for by tracking atleast the closest such intersection detected for a given ray, usuallywith other data defining the ray (for convenience).

Then, after a given ray has been tested against the entirety of thescene, a closest detected intersection, if any, for each ray can bereturned with the ray ID to an application or a driver or anotherprocess that can use such results for initiating shading processes. Theray identifiers can be returned via a queuing strategy, such as thoseaccording to the various examples herein (i.e., it is not necessary tospecify what compute resource will be executing shading code for aparticular intersection, nor does a particular intersection testingresource have its detected intersections tested by a predeterminedshading resource). In some intersection tests, barycentric coordinatesare calculated for intersection testing, and these coordinates can bemade available for shading, if desired. This is an example of other datathat can be transmitted from intersection testers to shaders.

Generally, any of the functions, features, and other logic describedherein can be implemented with a variety of computing resources. Acomputing resource can be a thread, a core, a processor, a fixedfunction processing element, and the like. Also, other functions, suchas collection or packet management can be provided or implemented as aprocess, thread or task that can be localized to one computing resourceor distributed among a plurality of computing resources (e.g., aplurality of threads distributed among a plurality of physical computeresources). The task essentially comprises identifying packets in flightthat have intersection test results for the shape having a collectionmanaged by that computing resource.

Likewise, computing resources being used for intersection testing canalso host other processes, such as shading processes that are used toshade intersections detected. For example, a processor that executesintersection testing also can execute shading threads. For example, in aring bus implementation, if the queue for one processing resource doesnot currently have any packets for intersection testing then dataprocessing resource can instead start a thread for shading previouslyidentified intersections. A principal difference being that there is norequirement or general relationship between having an intersection testthread on a given processor also run a shading thread for a rayintersection detected by that thread. Instead, queued ray/primitiveintersections provide ray inputs for shading threads, and thus themapping between intersection testing resources and shading resources canbe any to any, such that different hardware units or software units canintersection test and shade for the same ray.

Likewise, the various queues and other interfaces intermediatingcommunication among different functions (e.g., between intersectiontesting resources and between intersection testing and shading) can beimplemented in one or more memories according to any of a variety ofbuffering strategies that can be selected based on considerationsrelating to the physical resources available for implementing them.Queues can be controlled by an originating resource, or by a destinationresource. In other words, a destination can be listening for data on ashared bus and can take data it needs, or data can be addressed to it,via memory mapping, direct communication, or the like.

By further example, if a core can support multithreading, then a threadcan be dedicated to shading while another thread can be dedicated tointersection processing. Care would have to be taken however, to avoidcache incoherency resulting from fetching textures and other shadinginformation at the expense of maintaining ray data, which remains apriority for cache allocation for intersection testing resources.

Since it is contemplated that an advantage of this architecture is thatcaching requirements for shape data are reduced, cache coherencyconsiderations for that kind of data are reduced. In fact, in someimplementations little effort may need to be spent on keeping certainshape data available, or on predicting when shape data will be usedagain. Instead, when a given packet of ray IDs is ready for testing,shape data for those packet(s) can be obtained from the fastest memorythen storing it, and generally, existing workloads of processing otherpackets will shield any latency incurred in such fetching. After testingthose shapes for intersection, the shape data can be allowed to beoverwritten.

Any of the queues identified herein can be implemented in shared memoryresources, in SRAMs, as linked lists, circulation buffers, memorysequential or striped memory locations, or in any other functional formknown in the art for a queue. Queues can operate to maintain an orderingof packets, such that a packet first arriving will be first to exit, butthat is not a requirement. In some examples, each computing resource maybe provided with an ability to examine a given number of packets in itsqueue to determine whether or not it may be advantageous to process thepackets out of order. Such an implementation would be more complex thanan in-order system, but can be provided as desired.

Computer-executable instructions comprise, for example, instructions anddata which cause or otherwise configure a general purpose computer,special purpose computer, or special purpose processing device toperform a certain function or group of functions. The computerexecutable instructions may be, for example, binaries, intermediateformat instructions such as assembly language, or source code. Althoughsome subject matter may have been described in language specific toexamples of structural features and/or method steps, it is to beunderstood that the subject matter defined in the appended claims is notnecessarily limited to these described features or acts. Rather, thedescribed features and steps are disclosed as examples of components ofsystems and methods within the scope of the appended claims.

Above, various examples of computing hardware and/or softwareprogramming were explained, as well as examples how suchhardware/software can intercommunicate. These examples of hardware orhardware configured with software and such communications interfacesprovide means for accomplishing the functions attributed to each ofthem. For example, a means for intersection testing according to someexamples herein can comprise any of the following (1) a plurality ofindependently operable computing resources, each having a localizedstore of ray definition data, and operable to test ray(s) forintersection with shapes in response to being provided an identifier forthose ray(s) and shape data.

For example, a means for managing collections of rays comprises acomputing resource configured with programming, or an FPGA or an ASIC,or a portion thereof, that implements tracking of groups of rayidentifiers and associates groups with elements of acceleration data,and which can cause, or provide information for causing formation of apacket with the ray identifiers and either a reference to a shape orshape data determined by the shape associated with the group of rayidentifiers.

For example, a function described above includes communicatingidentifiers for rays that have completed intersection testing andintersected a primitive, through a queue, for processing in computingresources configured for shading those intersections. Means forimplementing this function can comprise a hardware queue, or sharedmemory space organized as a queue or list, such as memory configured asa ring buffer, or as a linked list, or the like. The means thus caninclude programming and/or logic that causes a ray identifier and aprimitive identifier to be obtained from a next or a specified slot in aqueue or a location in memory. A controller can manage the queue ormemory to maintain a next read position and a next write position foroutgoing and incoming ray and primitive identifiers. Such queuing meansalso can be used to interface intersection testing resources togetherwhen those resources pass packets of ray identifiers and shape data toeach other. Such queuing means also can be used to receive rayidentifiers for new rays awaiting commencement of intersection testing.Thus, each such more specific queuing function can be implemented bythese means or their equivalents.

For example, a function described above includes shading identifiedintersections between rays and primitives. This function can beimplemented by means comprising computing hardware configured withprogramming associated with intersected primitives. The programming cancause the computing hardware to obtain data such as textures, proceduralgeometry modifications and so on to determine what other information isrequired to determine what effect that primitive has on light hittingit. The programming can cause emission of new rays to be furtherintersection tested (e.g., shadow, refraction, reflection rays). Theprogramming can interface with an application programming interface forcausing emission of such rays. The rays as defined by the shadingprogramming can comprise origin and direction definition information,and a controller can determine ray identifiers for such defined rays.Fixed function hardware can be used to implement portions of suchfunctionality. However, it is preferred to allow programmable shadingusing computing resources that can be configured according to codeassociated with intersected primitives and/or other code as desirable ornecessary.

For example, another function described above was maintaining a masterlist of rays being tested for intersection and/or awaiting intersectiontesting, and distributing subsets of these master rays among distributedcache memories that are associated with means for intersection testing.Such a function can be implemented with means comprising a processor orgroup of processors that can use an integrated or separate memorycontroller to interface with a memory for storing data under the controlof programming implementing those functions. Such programming can beincluded at least partially in a driver associated with or otherwisecontrolling intersection testing functionality.

Aspects of functions, and methods described and/or claimed may beimplemented in a special purpose or general-purpose computer includingcomputer hardware, as discussed in greater detail below. Such hardware,firmware and software can also be embodied on a video card or otherexternal or internal computer system peripherals. Various functionalitycan be provided in customized FPGAs or ASICs or other configurableprocessors, while some functionality can be provided in a management orhost processor. Such processing functionality may be used in personalcomputers, desktop computers, laptop computers, message processors,hand-held devices, multi-processor systems, microprocessor-based orprogrammable consumer electronics, game consoles, network PCs,minicomputers, mainframe computers, mobile telephones, PDAs, pagers, andthe like.

Further, communication links and other data flow constructs shown in thefigures, such as links 112, 121, and 118 of FIG. 1, and similar links inother figures can be implemented in a variety of ways depending on theimplementation of the functions identified. For example, if intersectiontesting unit 109 comprises a plurality of threads executing on one ormore CPUs, then link 118 can comprise physical memory access resourcesof such CPU(s) and appropriate memory controllerhardware/firmware/software to provide access to ray data storage 105. Byfurther example, if intersection testing region 140 were on a graphicscard connected by a PCI Express bus to host 140, then links 121 and 112would be implemented using the PCI Express bus.

Intersection testing as described herein will generally exist in thecontext of larger systems and components of systems. For example,processing can be distributed over networks, such as local or wide areanetworks and may otherwise be implemented using peer to peertechnologies and the like. Division of tasks can be determined based ona desired performance of the product or system, a desired price point,or some combination thereof. In embodiments implementing any of thedescribed units at least partially in software, computer-executableinstructions representing unit functionality can be stored oncomputer-readable media, such as, for example, magnetic or opticaldisks, flash memory, USB devices, or in networks of storage devices suchas NAS or SAN equipment, and the like. Other pertinent information, suchas data for processing can also be stored on such media.

Also, in some cases terminology has been used herein because it isconsidered to more reasonably convey salient points to a person ofordinary skill, but such terminology should not be considered toimpliedly limit a range of implementations encompassed by disclosedexamples and other aspects. For example, a ray is sometimes referred toas having an origin and direction, and each of these separate items canbe viewed, for understanding aspects of the disclosure, as beingrepresented respectively as a point in 3-D space and a direction vectorin 3-D space. However, any of a variety of other ways to represent a raycan be provided, while remaining within the present disclosures. Forexample, a ray direction also can be represented in sphericalcoordinates. It also would be understood that data provided in oneformat can be transformed or mapped into another format, whilemaintaining the significance of the information of the data originallyrepresented.

Also, a number of examples have been illustrated and described in thepreceding disclosure, each illustrating different aspects that can beembodied systems, methods, and computer executable instructions storedon computer readable media according to the following claims. Bynecessity, not every example can illustrate every aspect, and theexamples do not illustrate exclusive compositions of such aspects.Instead, aspects illustrated and described with respect to one figure orexample can be used or combined with aspects illustrated and describedwith respect to other figures. As such, a person of ordinary skill wouldunderstand from these disclosures that the above disclosure is notlimiting as to constituency of embodiments according to the claims, andrather the scope of the claims define the breadth and scope of inventiveembodiments herein.

We claim:
 1. A method of concurrently performing graphics computations,comprising: determining, by a controller, using status informationstored in a memory, a subset of rays from a set of rays; submitting,from the controller, the rays of the subset concurrently to a pluralityof computation units, each computation unit comprising one or moreprocessor cores, and configured to process the rays according todetermined common program instructions; performing the common programinstructions on the submitted rays, by the plurality of computationunits, to produce results for the of rays, wherein the results comprisethat some of the rays can be processed concurrently using further commonprogram instructions, but remaining rays do not require such processing;and coalescing data for the rays that can be processed concurrentlyusing the further common program instructions and updating the statusinformation using the coalesced data for the rays, wherein the acts ofdetermining and submitting are performed asynchronously from theperformance of program instructions by the plurality of computationunits.
 2. The method of concurrently performing graphics computations ofclaim 1, wherein the status information stored in the memory comprises adata structure that has a pre-determined number of locations and thedata for the rays are coalesced into a portion of those locations,leaving other locations empty.
 3. The method of concurrently performinggraphics computations of claim 2, further comprising adding rays to theempty locations, the added rays obtained from the set of rays accordingto status information that those added rays await processing using thefurther common program instructions.
 4. The method of concurrentlyperforming graphics computations of claim 1, wherein results comprise anindication whether each ray hit or missed an identified shape, and therays that can be processed using the further common program instructionsare either rays that all hit or all missed the identified shape.
 5. Themethod of concurrently performing graphics computations of claim 4,wherein the wherein results comprise a bit for each ray of the subset,indicating the hit or miss condition of that ray.
 6. An apparatus forconcurrently performing 3-D graphics rendering, comprising: a first setof computation units, each computation unit comprising one or moreprocessor cores, each computation unit capable of executing a firstsub-portion of a rendering process on a set of data elements to producea result, the produced result comprising that a subset of the dataelements in the set can be concurrently processed by common programinstructions for a further sub-portion of the rendering process, butthat the remaining data elements of the set cannot, wherein the subsetof data elements can be dispersed among the remaining data elements,within the set of data elements, and the first set of computationelements is configured to coalesce the results into a data structure foroutput; and a second set of computation units, each computation unitcomprising one or more processor cores, each computation unit configuredfor executing the further sub-portion of a rendering process on dataelements arriving at the second set of computation units from two ormore data structures from the first set of computation units.
 7. Theapparatus for concurrently performing 3-D graphics rendering of claim 6,wherein the second set of computation units is configured for receivingdifferent numbers of data elements in the two or more data structures,and to form a group of data elements, having up to a maximum number ofdata elements, from the data elements in the two or more datastructures, the maximum number being selected based on a maximum numberof parallel operations that can be performed by the second set ofcomputation units.
 8. An apparatus for concurrently performing 3-Dgraphics rendering, comprising: a main system memory; a controllerconfigured to generate memory accesses for blocks of data stored in themain system memory; a plurality of computation units, each computationunit comprising one or more processor cores; a local working memorycoupled with the plurality of computation units; wherein execution ofdifferent sub-portions of a rendering process, each sub-portion beingrepresented by a respective set of instructions, and having a relativeorder with respect to other sub-portions of the rendering process, isallocated among respective subsets of the plurality of computationunits, the controller is configured to determine groupings of dataelements to begin the rendering process, and to initiate transactions tothe main system memory, each of the plurality of computation unitsoperates on local working memory for the grouping of data elementscurrently being processed by the subset of computation units, of whichthat computation unit is a part, and the computation units of eachsubset are configured to produce results of the sub-portion of therendering process allocated to that subset, the results comprising thatdifferent data elements of a grouping of data elements may requireprocessing with different sub-portions of the rendering process.